zwoop opened a new issue, #13618:
URL: https://github.com/apache/trafficserver/issues/13618
While reviewing #13204, we realized that `hrw4u` generally doesn't exit with
a status code on errors, unless `--stop-on-error` is given. This applies to
`u4wrh` as well.
In the default error-collecting mode, every input error — syntax *and*
semantic — is reported on stderr, partial output still goes to stdout, and the
process exits 0:
```
$ uv run ./scripts/hrw4u /tmp/foo.hrw4u
cond %{TXN_CLOSE_HOOK} [AND]
/tmp/foo.hrw4u:2:4: error: Unknown statement function: 'counters'
2 | counters("my.stat");
| ^
$ echo $?
0
```
`generate_output()` gates `sys.exit(1)` on `tree is None`
(`tools/hrw4u/src/common.py:281`), which with `DefaultErrorStrategy` never
happens — the parser recovers and returns a tree. Only `--stop-on-error` (bail
strategy) and I/O failures exit non-zero.
So nothing can wrap either tool: CI steps, Makefiles, and `u4wrh in.hrw >
out.hrw4u && hrw4u out.hrw4u` all see success on a failed compile. In bulk
`in:out` mode a broken artifact is left on disk under a name that looks
converted.
Suggested fix, keeping collect-all behavior (the flag should control when we
stop, not whether the run failed): return a failure flag from
`generate_output()`, OR it across all inputs at the three call sites
(`common.py:366`, `:401`, `:429`), and `sys.exit(1)` at the end of
`run_main()`. Also skip the `print` at `common.py:265` — or in `in:out` mode,
don't write the output file at all — when errors were collected.
--
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]