Fix: tail fails under pseudo with "couldn't allocate absolute path"#9305
Fix: tail fails under pseudo with "couldn't allocate absolute path"#9305naoNao89 wants to merge 9 commits into
Conversation
2dda7a0 to
486df67
Compare
Merging this PR will not alter performance
Comparing Footnotes
|
|
GNU testsuite comparison: |
| // On non-macOS systems, use is_stdin_directory() which works correctly | ||
| #[cfg(not(target_os = "macos"))] | ||
| { | ||
| if uucore::fs::is_stdin_directory(&stdin()) { |
There was a problem hiding this comment.
Why can't we simply fix the uucore function?
There was a problem hiding this comment.
We clarified offline that "sr" means "sorry", and "@@" is a dizzy face smiley meaning overwhelmed / confused.
There was a problem hiding this comment.
@@ -> icon 😵 or 😵💫
There was a problem hiding this comment.
if I were an AI, i would write comments in an expert tone, akin to a research paper or technical doc :v
a875910 to
6fb203c
Compare
|
GNU testsuite comparison: |
6fb203c to
72737e7
Compare
|
GNU testsuite comparison: |
72737e7 to
98c7793
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Can you please check the CI issue? |
bb9ced1 to
f54dcc6
Compare
|
GNU testsuite comparison: |
Avoid canonicalizing stdin when it's a pipe to prevent realpath() errors under pseudo (Yocto/OpenEmbedded). Changes: 1. In Input::resolve() (paths.rs): Check file type before canonicalizing. Only canonicalize regular files, skip pipes/fifos/dirs. 2. In tail_stdin() (tail.rs): Add early directory check for stdin. On non-macOS systems, detect directory stdin before path resolution to provide correct error message matching test expectations. This fixes the issue where tail commands like 'grep pattern file | tail' fail under pseudo with 'couldn't allocate absolute path' errors. Fixes uutils#9292
The macOS-specific workaround in tail_stdin() was unnecessary because fstat() on stdin's file descriptor correctly detects directories on all Unix platforms, including macOS. The real macOS issue was with canonicalize() on /dev/stdin paths, not with fstat(). Remove the duplicate platform-specific blocks and use a single call to uucore::fs::is_stdin_directory() which works on all platforms. Also consolidate the macOS-specific test into the cross-platform test_stdin_redirect_dir test, producing the correct error message on all platforms. See: rust-lang/rust#95239
ba8ec45 to
fc8d77d
Compare
0854eca to
fa0affc
Compare
221d29c to
090c811
Compare
tail calls .canonicalize() on stdin pipes → triggers realpath() → pseudo fails with "couldn't allocate absolute path"
Fix: Check file type first. Skip canonicalization for pipes, only canonicalize regular files.
Fixes #9292
Verified: Tested with pseudo in Ubuntu container