Skip to content

ptx: name the missing file in break/ignore/only file errors - #15328

Closed
ozenyunus35 wants to merge 2 commits into
uutils:mainfrom
ozenyunus35:ptx-break-file-error-path
Closed

ozenyunus35 wants to merge 2 commits into
uutils:mainfrom
ozenyunus35:ptx-break-file-error-path

Conversation

@ozenyunus35

Copy link
Copy Markdown
Contributor

Fixes #15307

The -b, -i and -o file errors were mapped with an empty context (map_err_context(String::new)), so a missing file showed up as ptx: : No such file or directory. They now use the file name (via maybe_quote), so it reads ptx: nosuch: No such file or directory, like GNU. The issue mentions -b, but -i and -o had 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 ptx tests 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.

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
Comment thread src/uu/ptx/src/ptx.rs Outdated
}

/// The name of the file given to `option`, for error messages.
fn filter_file_name(matches: &clap::ArgMatches, option: &str) -> String {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read_word_filter_file/read_char_filter_file already have filename, could we do the map_err_context there and drop this helper?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, the helper is gone and the readers add the context themselves.

Comment thread tests/by-util/test_ptx.rs Outdated
.pipe_in("x\n")
.fails_with_code(1)
.no_stdout()
.stderr_contains("ptx: nonexistent: ");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be stderr_is("ptx: nonexistent: No such file or directory\n"), no?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, changed.

@codspeed

codspeed Bot commented Oct 14, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.89%

⚠️ 120 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 398 untouched benchmarks
⏩ 70 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

@ozenyunus35

Copy link
Copy Markdown
Contributor Author

Closing this, as I can't follow up on it further. Thanks for the reviews.

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.

ptx: break file missing path in error message

2 participants