Skip to content

more: use OS errors instead of hardcoded locales - #14085

Open
Devel08 wants to merge 1 commit into
uutils:mainfrom
Devel08:more-use-os-error
Open

more: use OS errors instead of hardcoded locales#14085
Devel08 wants to merge 1 commit into
uutils:mainfrom
Devel08:more-use-os-error

Conversation

@Devel08

@Devel08 Devel08 commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This PR replaces hardcoded error message with native OS error

@codspeed-hq

codspeed-hq Bot commented Aug 22, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 4.44%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 3 regressed benchmarks
✅ 354 untouched benchmarks
⏩ 50 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation numfmt_stream_to_si_precision 330.4 ms 348 ms -5.05%
Simulation du_wide_tree[(5000, 500)] 19.4 ms 20.3 ms -4.19%
Simulation du_summarize_balanced_tree[(5, 4, 10)] 16 ms 16.7 ms -4.07%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Devel08:more-use-os-error (6e38031) with main (9875296)

Open in CodSpeed

Footnotes

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

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/tail-n0f (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/cp/link-heap is now passing!

more-error-is-directory = {$path} is a directory.
more-error-cannot-open-no-such-file = cannot open {$path}: No such file or directory
more-error-cannot-open-io-error = cannot open {$path}: {$error}
more-error-is-directory = {$path}: Is a directory

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.

Where is the place more-error-is-directory cannot be replaced by os error? (Removing it at another PR is fine).

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.

File::open() doesn't throw an error when a file is a directory, thus we have to check that manually

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.

EISDIR (or EPERM) is returned when read was called for directory. So the arm

Self::IsDirectory(path) => {
write!(
f,
"{}",
translate!(
"more-error-is-directory",
"path" => path.quote()
)
)
}
can be removed on many unix.

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.

yeah it's returned on read, but the message will look something like "more: Is a directory", the path will be missing, if we rely on the message that read returns, should we let read's message or the custom locale?

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.

I'll fix this at different PR using format! or something else.

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.

2 participants