Skip to content

Accept a value starting with a dash for every string option - #2102

Open
xroche wants to merge 4 commits into
masterfrom
fz/B17
Open

xroche wants to merge 4 commits into
masterfrom
fz/B17

Conversation

@xroche

@xroche xroche commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner

Every option that takes a text value now accepts a value starting with -, as --user-agent -x already did. A word that names an option is still refused. So is a short option glued to its number or to one more, like -O -r6 or -P -qO. The options that always took such a value (-F, --assume and the rest of dashvalue_opt) still take it, so --user-agent -Oz works. A longer word such as -archive is taken as a value, and numeric options reject -5 with their own value check.

Tests 363, 564, 565 and 733 and the optalias self-test follow the new rule. The new 363 and 733 cases fail on the master binary, and a mutant that stops recognizing glued options fails 363 at -O -r6.

xroche and others added 4 commits November 7, 2026 19:25
Drop the dashvalue_opt allowlist: every option that takes a value now
takes a word starting with '-' unless that word names an option. The
htscoremain.c guards, the -O cluster step and the lone -N real form
accept a marked parameter the same way. Clustered spellings (-qP -x)
still refuse, since nothing vets them. Numeric options now reach their
own value check, so --warc-max-size=-5 says it needs a non-negative
number.

Tests 363, 565, 733 and the optalias self-test follow the new rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
A short option glued to its number or to one more option (-r6, -c8,
-qO, -#test) now names an option, so `-O -r6` fails rather than
mirroring into a folder named -r6. A longer word (-archive, -my%n) is
still taken as a value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
The -F, -%A, -%g, -%C, -%F, -%K, -%L, -%S, -%rf, -%X and --bundle-dir
options accepted a glued value such as `--user-agent -Oz` on master.
The previous commit refused it. Those options now skip the glued-option
check, and test 564 is back to `--user-agent -Oz`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche enabled auto-merge (squash) November 7, 2026 19:45
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