fix(readlink): emit GNU-style Invalid argument for non-symlinks#9189
Merged
cakebaker merged 2 commits intouutils:mainfrom Nov 8, 2025
Merged
fix(readlink): emit GNU-style Invalid argument for non-symlinks#9189cakebaker merged 2 commits intouutils:mainfrom
cakebaker merged 2 commits intouutils:mainfrom
Conversation
sylvestre
reviewed
Nov 8, 2025
src/uu/readlink/src/readlink.rs
Outdated
|
|
||
| let path = p.to_string_lossy().into_owned(); | ||
| let message = if err.raw_os_error() == Some(EINVAL) { | ||
| format!("{path}: Invalid argument") |
Contributor
Author
There was a problem hiding this comment.
Thanks for catching that! I've updated it to use translate!().
CodSpeed Performance ReportMerging #9189 will degrade performances by 3.33%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
GNU testsuite comparison: |
Contributor
Great, thanks! |
asder8215
pushed a commit
to asder8215/coreutils
that referenced
this pull request
Nov 8, 2025
…ls#9189) * fix(readlink): emit GNU-style Invalid argument for non-symlinks * Replace format! with translate! and test skip on Windows
naoNao89
pushed a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 8, 2025
…ls#9189) * fix(readlink): emit GNU-style Invalid argument for non-symlinks * Replace format! with translate! and test skip on Windows
naoNao89
pushed a commit
to naoNao89/coreutils
that referenced
this pull request
Nov 9, 2025
…ls#9189) * fix(readlink): emit GNU-style Invalid argument for non-symlinks * Replace format! with translate! and test skip on Windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes
readlinkemit the same “: Invalid argument” diagnostic that GNU prints when a non-symlink operand is rejected (GNU exercises this path by setting POSIXLY_CORRECT). We now detect EINVAL from read_link/canonicalize and force that message unless the user explicitly requested silent output; other IO errors still go through the existing context machinery.I also added
test_posixly_correct_regular_filetotests/by-util/test_readlink.rsso the regression covered by the GNU test case is reproduced in our Rust suite.#9127