Repository navigation
ptx: name the missing file in break/ignore/only file errors - #15328
ozenyunus35 wants to merge 2 commits into
Conversation
The errors for -b, -i and -o used an empty context, so a missing file was reported as "ptx: : No such file or directory". Use the file name, like GNU. Fixes uutils#15307
| } | ||
|
|
||
| /// The name of the file given to `option`, for error messages. | ||
| fn filter_file_name(matches: &clap::ArgMatches, option: &str) -> String { |
There was a problem hiding this comment.
read_word_filter_file/read_char_filter_file already have filename, could we do the map_err_context there and drop this helper?
There was a problem hiding this comment.
Done, the helper is gone and the readers add the context themselves.
| .pipe_in("x\n") | ||
| .fails_with_code(1) | ||
| .no_stdout() | ||
| .stderr_contains("ptx: nonexistent: "); |
There was a problem hiding this comment.
could be stderr_is("ptx: nonexistent: No such file or directory\n"), no?
Merging this PR will degrade performance by 10.89%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | factor_three_39_bit_primes |
567 ms | 801.4 ms | -29.25% |
| ❌ | Simulation | factor_five_38_bit_primes |
1.6 s | 1.7 s | -3.11% |
| ⚡ | Simulation | factor_thirteen_39_bit_primes |
9.5 s | 9.2 s | +3.23% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ozenyunus35:ptx-break-file-error-path (fc46b36) with main (c1565db)
Footnotes
-
70 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
|
Closing this, as I can't follow up on it further. Thanks for the reviews. |
Fixes #15307
The
-b,-iand-ofile errors were mapped with an empty context (map_err_context(String::new)), so a missing file showed up asptx: : No such file or directory. They now use the file name (viamaybe_quote), so it readsptx: nosuch: No such file or directory, like GNU. The issue mentions-b, but-iand-ohad the same problem.Added a test that runs all three options with a missing file and checks the name is in the error. It fails without the change, the
ptxtests pass, and clippy and fmt are clean.I used an AI assistant to help draft parts of the code and tests; I reviewed the changes and ran the tests myself.