Repository navigation
fix(batch): emit BATCH.sh wrapper with invoking binary path - #5906
Merged
Merged
Conversation
1 of 3 tasks
oferchen
force-pushed
the
fix/uts-batch-mode-batchsh-template-2
branch
from
June 17, 2026 21:23
5b347f6 to
7568dbd
Compare
Upstream rsync's `batch.c:259` writes `raw_argv[0]` into the generated `BATCH.sh` so the replay script works regardless of `PATH`. oc-rsync was hardcoding the bare name `oc-rsync` into the wrapper, which fails with `./BATCH.sh: line 1: oc-rsync: command not found` (exit 127) when the binary is invoked by absolute path - notably from the upstream testsuite and from CI, where the runner executes `/home/runner/.../target/release/oc-rsync --write-batch=BATCH ...` and the generated wrapper falls back on a `PATH` lookup that does not find the bare `oc-rsync` name. This was the failure observed on the upstream-testsuite `batch-mode` test on master at HEAD f5821c3 (CI run 27711564454): Test BATCH.sh use of --read-batch: Running: "./BATCH.sh" ./BATCH.sh: line 1: oc-rsync: command not found Failed: status=127 dir-diff file-diff Add an `invoker` field to `BatchConfig` (defaulting to `"oc-rsync"` for backward compatibility) and a `with_invoker` builder method. `generate_script_with_filters` now writes `config.invoker` through `shell_quote` so paths with spaces are safely single-quoted. The CLI workflow captures `std::env::args_os().next()` and threads it into the `BatchConfig` for both `--write-batch` and `--only-write-batch` modes, exactly mirroring upstream's `raw_argv[0]` semantics. Includes three regression tests: - absolute invoker path is embedded verbatim - invoker paths with spaces are shell-quoted - default invoker remains the bare `oc-rsync` name
oferchen
force-pushed
the
fix/uts-batch-mode-batchsh-template-2
branch
from
June 18, 2026 03:17
7568dbd to
71357f3
Compare
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Upstream rsync's `batch.c:259` writes `raw_argv[0]` into the generated `BATCH.sh` so the replay script works regardless of `PATH`. oc-rsync was hardcoding the bare name `oc-rsync` into the wrapper, which fails with `./BATCH.sh: line 1: oc-rsync: command not found` (exit 127) when the binary is invoked by absolute path - notably from the upstream testsuite and from CI, where the runner executes `/home/runner/.../target/release/oc-rsync --write-batch=BATCH ...` and the generated wrapper falls back on a `PATH` lookup that does not find the bare `oc-rsync` name. This was the failure observed on the upstream-testsuite `batch-mode` test on master at HEAD 0171248 (CI run 27711564454): Test BATCH.sh use of --read-batch: Running: "./BATCH.sh" ./BATCH.sh: line 1: oc-rsync: command not found Failed: status=127 dir-diff file-diff Add an `invoker` field to `BatchConfig` (defaulting to `"oc-rsync"` for backward compatibility) and a `with_invoker` builder method. `generate_script_with_filters` now writes `config.invoker` through `shell_quote` so paths with spaces are safely single-quoted. The CLI workflow captures `std::env::args_os().next()` and threads it into the `BatchConfig` for both `--write-batch` and `--only-write-batch` modes, exactly mirroring upstream's `raw_argv[0]` semantics. Includes three regression tests: - absolute invoker path is embedded verbatim - invoker paths with spaces are shell-quoted - default invoker remains the bare `oc-rsync` name
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.
Summary
batch.c:259writesraw_argv[0]literally into the generatedBATCH.shso the replay script works regardless ofPATH. oc-rsync was hardcoding the bare nameoc-rsyncinto the wrapper, which fails with./BATCH.sh: line 1: oc-rsync: command not found(exit 127) when the binary is invoked by absolute path - notably from the upstream testsuite and from CI.invokerfield toBatchConfig(defaulting to"oc-rsync"for backward compatibility) and awith_invokerbuilder method. The CLI workflow capturesstd::env::args_os().next()and threads it into theBatchConfigfor both--write-batchand--only-write-batchmodes.generate_script_with_filtersnow writesconfig.invokerthroughshell_quoteso paths with spaces are safely single-quoted.CI failure reproduced
CI run 27711564454 on master HEAD
f5821c3b5failed the upstream-testsuitebatch-modetest at theBATCH.sh use of --read-batchstep:The runner invokes the binary by absolute path (
/home/runner/work/rsync/rsync/target/release/oc-rsync), so the generated wrapper that referenced bareoc-rsynccould not be resolved throughPATH.Upstream reference
target/interop/upstream-src/rsync-3.4.4/batch.c:259:Upstream writes the literal invocation path the user passed on the command line. This change mirrors that behavior.
Test plan
test_generate_script_embeds_absolute_invoker_pathexercises the failure mode by configuring an absolute invoker and asserting the wrapper starts with that path.test_generate_script_quotes_invoker_with_spacescovers shell-safe quoting of paths with spaces.test_generate_script_default_invoker_is_bare_namepins the backward-compatible default for callers that don't configure an invoker.test_generate_scriptcontinues to assert the script containsoc-rsync, validating that the default path is preserved.batch-modeshould now pass theBATCH.sh use of --read-batchphase that was failing withcommand not found.