Skip to content

runtests.py: accept a relative --rsync-bin#921

Merged
tridge merged 1 commit into
RsyncProject:masterfrom
tridge:pr-runtests-relpath
May 26, 2026
Merged

runtests.py: accept a relative --rsync-bin#921
tridge merged 1 commit into
RsyncProject:masterfrom
tridge:pr-runtests-relpath

Conversation

@tridge
Copy link
Copy Markdown
Member

@tridge tridge commented May 26, 2026

Tests are launched with subprocess.run(..., cwd=TOOLDIR) so the subprocess's argv[0] resolves against TOOLDIR, not the runner's invocation cwd. A user-supplied --rsync-bin=../foo/rsync therefore worked when invoked from inside TOOLDIR but silently failed (or ENOENT'd inside individual tests) when invoked from a sibling directory.

Fix: absolutize rsync_bin via os.path.abspath() at parse time, before it propagates into build_rsync_cmd()/RSYNC. abspath() captures os.getcwd() now, which is the operator's invocation cwd -- exactly what the --rsync-bin=../path form expresses.

Regression check:

cd /tmp/somewhere-else
ln -s /path/to/rsync ./alt/rsync
python3 /path/to/rsync-git/runtests.py
--rsync-bin=./alt/rsync
--srcdir=/path/to/rsync-git --tooldir=/path/to/rsync-git
00-hello

Before this commit the test failed at subprocess time with the relative path being looked up under TOOLDIR; after, it passes.

Tests are launched with subprocess.run(..., cwd=TOOLDIR) so the
subprocess's argv[0] resolves against TOOLDIR, not the runner's
invocation cwd. A user-supplied --rsync-bin=../foo/rsync therefore
worked when invoked from inside TOOLDIR but silently failed (or
ENOENT'd inside individual tests) when invoked from a sibling
directory.

Fix: absolutize rsync_bin via os.path.abspath() at parse time, before
it propagates into build_rsync_cmd()/RSYNC. abspath() captures
os.getcwd() now, which is the operator's invocation cwd -- exactly
what the --rsync-bin=../path form expresses.

Regression check:

  cd /tmp/somewhere-else
  ln -s /path/to/rsync ./alt/rsync
  python3 /path/to/rsync-git/runtests.py \
      --rsync-bin=./alt/rsync \
      --srcdir=/path/to/rsync-git --tooldir=/path/to/rsync-git \
      00-hello

Before this commit the test failed at subprocess time with the relative
path being looked up under TOOLDIR; after, it passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tridge tridge merged commit 8bbea98 into RsyncProject:master May 26, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant