rsync-ssl, testsuite: accept --type=SSL_TYPE anywhere in the args - #1047
rsync-ssl, testsuite: accept --type=SSL_TYPE anywhere in the args#1047Zeno-sole wants to merge 1 commit into
Conversation
The --type=... option was only recognized as the first argument, so a command such as "rsync-ssl --dry-run --type=stunnel host::mod" passed the option through to the underlying rsync, which rejected it as unknown. Scan the full argument list for --type=..., export RSYNC_SSL_TYPE, and drop the option before handing the remaining args to rsync. The manpage no longer says the option must be first. Adds a test that runs rsync-ssl with a fake rsync in PATH and checks that --type= is consumed in first, middle, and last positions.
|
Before repair: After repair: |
|
I would like to kindly request a code review from the upstream author/maintainer. @tridge |
|
No need to ping after less then 24 hours. 1) a release has just been made with major security concerns, we are resting. 2) its been less then 24 hours :D Let's be respectful. "kindly" doesn't make something respectful. |
| args=() | ||
| for arg in "$@"; do | ||
| if [[ "$arg" == --type=* ]]; then | ||
| export RSYNC_SSL_TYPE="${arg#--type=}" | ||
| else | ||
| args+=("$arg") | ||
| fi | ||
| done | ||
| set -- "${args[@]}" |
There was a problem hiding this comment.
Stop interpreting wrapper options at --
As written, rsync-ssl -- --type=stunnel consumes an operand that was explicitly protected from option parsing. Preserve -- and every subsequent argument, and add a regression for this case.
The --type=... option was only recognized as the first argument, so a command such as "rsync-ssl --dry-run --type=stunnel host::mod" passed the option through to the underlying rsync, which rejected it as unknown. Scan the full argument list for --type=..., export RSYNC_SSL_TYPE, and drop the option before handing the remaining args to rsync. The manpage no longer says the option must be first.
Adds a test that runs rsync-ssl with a fake rsync in PATH and checks that --type= is consumed in first, middle, and last positions.