shell: Add sync-exclude flag and .limasyncignore file#4917
Conversation
844ed46 to
5785cfc
Compare
|
@liketosweep You mentioned that you would be able to help with windows verification of this PR. I only have a linux and mac machine that I was able to test it on, and there everything worked fine and I was successfully able to build and use the binary. As I don't have a windows machine available to me, could you help me with the windows part? |
|
@peschmae on it |
5785cfc to
7b8be1e
Compare
|
Just updated the PR once more, after running the linting tools. |
Windows Verification Report — PR #4917
✅ What Was Tested
❌ Blockers Found1. Missing
|
|
@peschmae I've published the results of all the test i have conducted above . |
|
Thanks for the review, I had a quick look at your findings.
I assume this is already the case with 2.1? I can investigate this, but I think this is unrelated to this PR.
I'm not able to reproduce this, with your reproduction sample, but if I don´t provide a path, it takes the eg. limactl shell --sync --sync-exclude='.git*' ai-boxBut this would then be the same finding as 3, which also doesn´t provide a directory in the reproduction sample.
limactl shell --sync default lsIn this example, you provide the directory |
|
@peschmae, thanks for the feedback regarding positional argument order. I re-tested natively on Windows using the explicit directory Updated Command: Observed Behavior: The CLI still appends subsequent flags/arguments directly to the host path string (e.g., Finding: Even with the corrected syntax, the Windows parser fails to properly terminate the path string before moving to the next argument, causing the "directory depth" fatal error. I've attached a fresh trace showing the result with the updated command structure. Regarding
The above image shows the commands executed . Note: AI was utilized during the testing process and for the documentation of this report. |
To avoid syncing generated or sensitive data into a vm, a new sync-exclude flag is added, to be used in conjunction with --sync. This allows to specify rsync excludes which are then not synced. Additionally a .limasyncignore file can be created, which also considered and passed to rsync as the exclude-from flag. Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
7b8be1e to
6e86471
Compare
| limactl shell --sync . --sync-exclude .git default | ||
| ``` | ||
|
|
||
| Alternatively a `.limasyncignore` file can be created in the target directory, which contains a list of excludes. |
There was a problem hiding this comment.
Not sure if we want to have a .limasyncignore file, maybe we can have something like https://lima-vm.io/docs/config/environment-variables/#lima_shellenv_block but would love to know what other maintainers think of this.
There was a problem hiding this comment.
Another option would be, to implement a --sync-exclude-from flag, which the user can then point to a specific file. This would remove the magic where files aren't synced, since it would need a conscious decision by the user to set the flag.
|
I've rebased my feature branch to master, to get the latest changes. Additionally I've implemented a better handling of the $ limactl shell --sync --sync-exclude=git ai-box ls
FATA[0000] --sync flag requires a directory path argument, got "--sync-exclude=git" instead
Usage: limactl shell --sync <DIR> [--sync-exclude <PATTERN>...] <INSTANCE> [COMMAND...]
$ limactl shell --sync . --sync-exclude=git ai-box ls
INFO[0000] Syncing host current directory(/home/peschmae/upstream/lima) to guest instance...
INFO[0000] Successfully synced host current directory to guest(/home/peschmae.guest/home/peschmae/upstream/lima) instance.
LICENSE MAINTAINERS.md Makefile NOTICE README.md ROADMAP.md _output cmd docs go.mod go.sum hack pkg templates vz.entitlements website
INFO[0000] No changes detectedRegarding the error @liketosweep got in the shell on windows, this probably requires more indepth analysis, and I guess it also happens with the latest released version. In the |
Signed-off-by: Mathias Petermann <mathias.petermann@gmail.com>
4c25bd2 to
37bef33
Compare
|
I've generated a "deep" AI review using multiple agents: https://jandubois.github.io/lima/20260501-221035-pr-4917.html I've not looked into the report myself, especially not into the Windows path findings, and how they would interact with the proposed changes to make Lima work on Windows without msys and git for Windows. |

Fix #4887
To avoid syncing generated or sensitive data into a vm, a new sync-exclude flag is added, to be used in conjunction with --sync. This allows to specify rsync excludes which are then not synced.
Additionally a .limasyncignore file can be created, which also considered and passed to rsync as the exclude-from flag.