shell: measure the --sync directory depth on the host's own path - #5340
Merged
Conversation
This was referenced Jul 26, 2026
jandubois
force-pushed
the
shell-sync-depth
branch
4 times, most recently
from
July 27, 2026 20:42
dcb5707 to
9937b27
Compare
`--sync` refuses a directory too close to the filesystem root, but on Windows it measured a path already converted to the /c/... form while still splitting on backslashes. Every directory counted as depth 1, so `--sync` could not run there at all. Measuring the native path keeps one threshold meaning the same thing everywhere. Only Windows separates on a backslash. Elsewhere it is an ordinary filename character, and counting it as a separator would score a directory just below the root deep enough to pass, so the caller now says which form it holds rather than leaving it implied. That guard was also the only thing stopping `--sync` when the conversion failed or returned nothing, because the empty string scored 1. Both now need their own error. An empty directory reaches rsync as the toolchain root, and with stdout not a terminal the sync back runs `--delete` against it unprompted. A wsl2 guest already reaches the host directory through the /mnt automount, so `--sync` cannot isolate it from host files there. It now refuses that combination up front. Signed-off-by: Jan Dubois <jan.dubois@suse.com>
jandubois
force-pushed
the
shell-sync-depth
branch
from
July 27, 2026 22:55
9937b27 to
174f386
Compare
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
--syncrefuses a directory too close to the filesystem root, but on Windows it measured a path already converted to the/c/...form while still splitting on backslashes. Every directory counted as depth 1, so--synccould not run there at all. Measuring the native path keeps one threshold meaning the same thing everywhere.Only Windows separates on a backslash. Elsewhere it is an ordinary filename character, and counting it as a separator would score a directory just below the root deep enough to pass, so the caller now says which form it holds rather than leaving it implied.
That guard was also the only thing stopping
--syncwhen the conversion failed or returned nothing, because the empty string scored 1. Both now need their own error. An empty directory reaches rsync as the toolchain root, and with stdout not a terminal the sync back runs--deleteagainst it unprompted.A wsl2 guest already reaches the host directory through the
/mntautomount, so--synccannot isolate it from host files there. It now refuses that combination up front.This is pre-existing and unrelated to the native Windows OpenSSH series. No test caught it because the BATS
--synctests run only onubuntu-24.04and the Windows jobs never invoke--sync. Running BATS on Windows needs submodules, an rsync install, and a vm-type hook inensure_instance, so that waits for the plain-Windows CI work.Assisted-by: Claude Opus 5