pathchk: reject an empty file name in portability modes to match GNU - #14069
pathchk: reject an empty file name in portability modes to match GNU#14069AlejandroCoronadoN wants to merge 2 commits into
Conversation
|
GNU testsuite comparison: |
| if !matches!(mode, Mode::Default) && path.join("/").is_empty() { | ||
| show_error!("{}", translate!("pathchk-error-empty-file-name")); | ||
| return false; | ||
| } |
There was a problem hiding this comment.
This change makes the "empty file name" checks in check_basic and check_extra unreachable if an empty file name is provided and so you can remove them.
| // fail on empty path | ||
| new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); |
There was a problem hiding this comment.
You can remove this test as it tests the same as your test, though your test is better.
Merging this PR will regress 1 benchmark
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | Simulation | du_deep_tree[(100, 3)] |
2.3 ms | 2.3 ms | -3.42% |
| ⚡ | Simulation | du_wide_tree[(5000, 500)] |
20.2 ms | 19.5 ms | +3.8% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing AlejandroCoronadoN:pathchk-empty-name-portability (fa12706) with main (a9b64fc)2
Footnotes
-
229 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. ↩
-
No successful run was found on
main(71ebb92) during the generation of this report, so a9b64fc was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
Unable to generate the performance reportThere was an internal error while processing the run's data. We're working on fixing the issue. Feel free to contact us on Discord or at support@codspeed.io if the issue persists. |
In
pathchk's portability modes (-p,-P,--portability), an empty file name diverges from GNU:-Pprintspathchk: '': No such file or directory(it runs the filesystem check first and never reaches the empty-name check).-pand--portabilityprintempty file namewithout thepathchk:prefix.GNU rejects an empty file name in any portability mode before touching the filesystem, always as
pathchk: empty file name:This adds the early empty-name check (using the existing localized string) for all portability modes. Default mode (
pathchk '') is unchanged.