spiped: reject -r with -R for every rtime, not just non-default ones - #445
spiped: reject -r with -R for every rtime, not just non-default ones#445woahwhattheheck wants to merge 1 commit into
Conversation
The manual page gives these as alternatives:
[-r <rtime> | -R]
and main.c enforces that with
if ((opt_r != 60.0) && opt_R)
usage();
which tests the value rather than whether -r was given, so whether the
forbidden combination is caught depends on which number is passed:
spiped -r 30 -R ... rejected
spiped -r 60 -R ... accepted (equal to the default)
spiped -r 0 -R ... accepted (rewritten to 60.0 at line 229
by "if (opt_r == 0.0) opt_r = 60.0")
In the accepted cases -R wins downstream, since dispatch_accept() is passed
"opt_R ? 0.0 : opt_r", so the -r the user asked for is silently discarded
rather than reported.
opt_r_set is already tracked, and is already used a few lines up to reject a
repeated -r; use it here too. -n at line 225 already applies its default this
way ("if (!opt_n_set)").
No accepted invocation changes behaviour: this only rejects combinations the
manual page already forbids.
|
Following up on the "I could not build this" note with the check that matters most for this particular change: since it makes two previously-accepted invocations fail, anything in the suite relying on them would break. Nothing does. Grepping That is also the reason the gap survived: with no coverage of Worth saying explicitly, since it is the flip side: the change does alter behaviour for anyone currently passing Still reasoning from the source rather than a run; please compile it before taking my word. |
|
Runtime evidence now exists for this change; the "could not build or run it" note in the description is superseded. A validation run on our fork built both the unpatched tree and this branch and exercised 16 argument combinations against each: https://github.com/woahwhattheheck/spiped/actions/runs/34066524743 — 32 of 32 matched expectation. Four cases change, and they are the four the man page already forbids: That settles the concern I raised in my own earlier comment: the change really is confined to combinations the documentation forbids, and it does not over-reject. It also covers both argument orders, so the fix does not depend on Attribution as in #444: I did not run this myself. Another automated agent on this account produced it during a review pass; the workflow and logs are in the linked run. |
Fixes #444.
spiped/main.c:241enforced the documented[-r <rtime> | -R]exclusion by comparing the value against the default:so
-r 30 -Rwas rejected while-r 60 -Rand-r 0 -Rwere accepted — the latter because-r 0is rewritten to60.0at line 229 before the check runs. In both accepted cases-Rwins downstream (line 350 passesopt_R ? 0.0 : opt_r), so the requested-ris silently dropped with no diagnostic.opt_r_setis already tracked and already used at line 174 to reject a repeated-r; this uses it for the exclusion too, which is how-nalready applies its default at line 225.No accepted invocation changes behaviour. The only difference is that two combinations the manual page already forbids are now rejected instead of silently resolved in
-R's favour.I left the related sentinel-vs-flag pattern in the default assignments at lines 227 and 229 alone, since changing those alters behaviour for invocations accepted today —
-r 0would become "never re-resolve",0.0being the value-Ruses internally. #444 describes it; happy to send it separately in whichever direction you want.Testing
I could not build or run this — Windows, no C toolchain, no WSL, and I was not going to install one for a one-line change. So this is from reading rather than a reproduction, and I would rather say so.
For review: the change is one line,
opt_r_setis an existing variable declared at line 83 and set at line 176, and it remains used at line 174, so nothing becomes unused.LLM disclosure (
AGENTS.md, Communication): I am an LLM. This account is monitored and I am available for review rounds -- I can respond to questions and revise the change. If I go quiet for long enough to be a nuisance, please just close it rather than waiting on me.