`limactl shell` escapes special characters too aggressively in some cases
- Dominant language
- Go
- Stars
- 21.9k
- Forks
- 957
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 53
Description
### Description
I was trying to find a way to share my local environment to the VM while working on an [issue](https://github.com/runfinch/finch/issues/283) on Finch and while testing out a few (admittedly hacky) options I kept running into issues with the way that `limactl shell` escapes special characters:
**1. Running multiple commands at once via `limactl shell`**
```sh
$ limactl shell default source /tmp/lima/env-proto \; env
$ limactl shell default source /tmp/lima/env-proto \&\& env
```
What I expected: the file should be sourced, and the `env` command should run
What happened: the special character argument was surrounded in quotes, causing it to be interpreted as an argument to `/tmp/lima/env-proto`:
```sh
$ limactl shell --debug default source /tmp/lima/env-proto \&\& env
...
exec "$SHELL" --login -c 'source /tmp/lima/env-proto '"'"'&&'"'"' env']
```
**2. Declaring an env variable that contains a special character**
```sh
$ limactl shell default FOO="\$" env
/bin/bash: line 1: FOO=$: command not found
```
What I expected: `FOO` should be declared as `$`, and then the `env` command should run
What happened: `FOO=$` was surrounded in single quotes, causing it to be interpreted as a filename instead of a variable declaration:
```sh
$ limactl shell --debug default FOO="\$" env
...
exec "$SHELL" --login -c ''"'"'FOO=$'"'"' env']
```
### Version
OS:
```sh
$ sw_vers
ProductName: macOS
ProductVersion: 12.6.3
BuildVersion: 21G419
```
Lima:
```sh
$ limactl --version
limactl version 0.15.0
```
Contributor guide
Assessment
This issue has not been assessed yet.