Skip to content

tail: Handle missing/dir paths via metadata()#10220

Open
Xylphy wants to merge 5 commits intouutils:mainfrom
Xylphy:tail-metadata-error-handling
Open

tail: Handle missing/dir paths via metadata()#10220
Xylphy wants to merge 5 commits intouutils:mainfrom
Xylphy:tail-metadata-error-handling

Conversation

@Xylphy
Copy link
Contributor

@Xylphy Xylphy commented Jan 13, 2026

Closes #10193

This pull request refactors error handling in the tail_file function in src/uu/tail/src/tail.rs to use path.metadata() for file checks and improves error reporting formatting.

Error handling and logic improvements:

  • Changed file existence and directory checks to use path.metadata(), enabling more robust detection of missing files and directories. This replaces separate checks for existence and directory status with a single match statement.
  • Added explicit handling for ErrorKind::NotFound to ensure missing files are reported with the correct error message and observer update, then exit early.

Error reporting formatting:

  • Updated error message formatting to use multi-line translate! calls for better readability and consistency across permission and file opening errors.

@Xylphy Xylphy changed the title Fix(tail): Handle missing/dir paths via metadata() tail: Handle missing/dir paths via metadata() Jan 13, 2026
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/fmt/non-space. tests/fmt/non-space is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/tty/tty-eof (fails in this run but passes in the 'main' branch)

@sylvestre
Copy link
Contributor

please fix the jobs

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 18, 2026

Merging this PR will not alter performance

✅ 284 untouched benchmarks
⏩ 38 skipped benchmarks1


Comparing Xylphy:tail-metadata-error-handling (3d21f21) with main (ec7e81e)

Open in CodSpeed

Footnotes

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

@Xylphy
Copy link
Contributor Author

Xylphy commented Jan 19, 2026

@sylvestre Done!

@github-actions
Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/misc/tee (fails in this run but passes in the 'main' branch)

@Xylphy Xylphy requested a review from sylvestre January 19, 2026 19:32
Add Unix-only tests covering the case where probing a path (e.g. via metadata)
fails with PermissionDenied (directory not searchable). Ensure we report
"Permission denied" rather than "No such file or directory", matching GNU tail.
@sylvestre sylvestre force-pushed the tail-metadata-error-handling branch from 050e9d0 to 7d9bfa8 Compare February 5, 2026 21:39
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

GNU testsuite comparison:

Congrats! The gnu test tests/basenc/bounded-memory is now passing!

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/pr/bounded-memory is no longer failing!

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.

tail: exists precheck masks permission errors

2 participants

Comments