Skip to content

Option values that mirrored the wrong thing at exit 0 - #1436

Merged
xroche merged 4 commits into
masterfrom
fix-structure-gaps
Aug 25, 2026
Merged

Option values that mirrored the wrong thing at exit 0#1436
xroche merged 4 commits into
masterfrom
fix-structure-gaps

Conversation

@xroche

@xroche xroche commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Two of the three spellings in #1434 mirrored the wrong thing at exit 0, both because the value mapped onto the bare short form.

--structure=on expanded to a bare -N, which reads the next word as a user template, so --structure=on <URL> swallowed the URL and mirrored nothing. "on" now names the default preset (-N0), the layout "off" already selected; #1418's glue rules are otherwise untouched.

--long-names= expanded to a bare -L, whose sscanf converted nothing and left the switch to re-map the value already stored, landing on DOS 8.3 names (-L1 -L did the same). Rather than refuse the empty value I fixed the short form: a bare -L now selects L1, the default the help and man page already star. Refusing would have taken sockets= and the config-file long-names= spelling with it, and this way the empty value means the option's own default. -L0, --long-names=off and --long-names=2 are unchanged.

Rewriting that parse surfaced a third bug, pre-existing and folded in here: the digit-run bound #1418 added counts digits rather than reading the value, so a zero-padded run falls off it. -L0000000001 selected ISO9660, -N0000000001 lost its preset, and --structure=0000000001 was refused. optalias_digits_fit skips the leading zeros first, shared by the four sites that read such a run.

The 27 param rows keep #1427's 16-character cap: its bound is a magnitude, not a run length, so optalias_digits_fit does not fit there — 9 significant digits would refuse --advanced-maxlinks=2000000000, and it cannot see the second operand of -m N,N2. Filed as #1437.

The third spelling in the issue, --structure=I0, has been refused since #1418 landed after the issue was measured, and test 368 pins that. What survives is --structure=8I0: the digits-then-cluster form #1418 glues on purpose, and the same shape as the --structure=1L0 that #1427's test pins as accepted. No rule separates the two, so that one wants a decision rather than a patch.

Closes #1434

xroche and others added 4 commits August 25, 2026 09:48
--structure=on expanded to a bare -N, which reads the next word as a user
template: the URL was swallowed and the run mirrored nothing. "on" now names
the default preset (-N0), like "off" already did.

--long-names= expanded to a bare -L, whose sscanf converted nothing and left
the switch to re-map the value already stored, so it selected DOS 8.3 names --
and -L1 -L did too. A bare -L now selects L1, the option's own starred default.

Closes #1434

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
The bound #1418 introduced counts digits, so a zero-padded run falls off it:
-L0000000001 selected ISO9660 where -L1 selects long names, -N0000000001 lost
its preset, and --structure=0000000001 was refused outright. optalias_digits_fit
skips the leading zeros before applying the bound, and the four sites that read
such a run share it.

Test 368 gains the padded spellings, and its template case now carries a
literal tpl/ marker: %h%p/%n%q.%t is the default layout for a file:// URL, so
it passed even with --structure back on the pre-#1418 "param" class.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche xroche changed the title Two option spellings that mirrored the wrong thing at exit 0 Option values that mirrored the wrong thing at exit 0 Aug 25, 2026
@xroche
xroche enabled auto-merge (squash) August 25, 2026 08:35
@xroche
xroche merged commit 38dd23f into master Aug 25, 2026
44 checks passed
@xroche
xroche deleted the fix-structure-gaps branch August 25, 2026 09:23
xroche added a commit that referenced this pull request Aug 25, 2026
The 16-character cap was doing two jobs. Dropping it let a long padded run
reach the 1024-byte expansion buffer, where strlcatbuff aborts: --depth with
1022 zeros exited 134 with a backtrace where master printed a syntax error.
Bound the value against the room the short form leaves, at the glue site, which
also covers the param0 rows that abort on master today (--allow, 1023 chars).

optalias_suffix() carried a copy of the same bare 16, so --generate-errors=
3000000000 still reached sscanf("%d") as -1294967296; it now takes the same
magnitude bound. Also: the errno != ERANGE idiom the tree already spells, LLint
over int64_t, and mirror_names/mirror_has_name shared with 362.

The PR body's claim about #1436 was wrong: optalias_digits_fit() is on that
branch, not in the tree, so --structure=0000000001 is refused here too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
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.

Three --structure and --long-names spellings mirror the wrong thing at exit 0

1 participant