readlink: Behaviour differs from GNU Coreutils when path exists but cannot be read
Open
Nobody has claimed this yet.
U - readlink
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
Running as a non-root user that does not have permission to read /proc/1/exe (since the init process is started as root):
Expected:
$ readlink -f /proc/1/exe /etc/hosts
/etc/hosts
Actual:
$ readlink -f /proc/1/exe /etc/hosts
/proc/1/exe
/etc/hosts
We do see the error raised correctly when Uutils doesn't canonicalize the path:
$ readlink -v /proc/1/exe /etc/hosts
readlink: /proc/1/exe: Permission denied
But it's returning early instead of processing the rest of the files:
GNU Coreutils
$ readlink -v -e /proc/1/exe /etc/hosts
readlink: /proc/1/exe: Permission denied
/etc/hosts
Running
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the readlink -f behavior with /proc/1/exe and /etc/hosts as a non-root user, then compare the -v and -e cases shown in the issue. Trace the readlink command's handling of each path and verify that the permission error is reported while the remaining path is still processed, matching the GNU Coreutils output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100