GiulioSavini commented on PR #13825: URL: https://github.com/apache/trafficserver/pull/13825#issuecomment-6169352788
Thanks, @brbzull0 — good catch, both timing bugs fixed. The root cause in both cases was the same: deferring a decision past the point where something else in the same scan (`-h`, `--version`, or just the next token) could run first. 1. `has_envvar` was "declared", not "currently set". Fixed by resolving the variable's current value *before* calling `handle_args()` and deferring only when it's non-empty; an unset variable now reports the exact same immediate error as if no variable were declared at all (verified `--run-root -h`/`-V` with `TS_RUNROOT` unset, and `server debug enable -t -c` with `TS_DEBUG_TAGS` unset, all back to base's wording and exit 64). 2. The mixed-occurrence check is no longer deferred to the end-of-scan loop — it fires the moment the second, contradicting occurrence is parsed (in both spellings), so nothing written after the conflicting pair gets a chance to run first. Verified `--run-root /some/path --run-root --help` with `TS_RUNROOT` set now exits 64 instead of 0. `AT_MOST_ONE_ARG_N` no longer goes through the deferred path at all — it resolves immediately in `handle_args()`, since repetition of it is already refused elsewhere and a missing value is valid for it regardless. `apply_env_fallback()` is gone with it. Also pinned the unit tests to the exact exit code (`REQUIRE_THROWS_WITH`) instead of any exception, added the `size()` check you pointed out, added `MORE_THAN_ZERO_ARG_N`-with-variable coverage, and fixed the two AuTest runs that weren't actually exercising what they claimed (run 17 now reads through a file with a different value than the live default, run 19's bare `-c` is now actually bare, and added the write-side run at the end). Ran the full `traffic_ctl_cold_config` AuTest locally against a built `traffic_server`/`traffic_ctl` — all 20 runs pass. `test_tscore` (117/117) and `format` both clean. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
