'test -r' returns wrong exit code for permissions granted by supplementary group membership
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 24.1k
- Forks
- 2k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 365
Description
test -r doesn't take into account permissions granted by supplementary / non-primary groups.
To replicate, run this as a regular non-root user that has at least one non-primary group membership:
nonprimarygroup=$(id -nG | awk '{print $2}')
echo $nonprimarygroup # for me this returns 'adm'
sudo install -d -m 750 -o root -g $nonprimarygroup /tmp/testdir
ls /tmp/testdir; echo $? # returns 0
gnutest -r /tmp/testdir; echo $? # returns 0
~/.cargo/bin/coreutils test -r /tmp/testdir; echo $? # incorrectly returns 1
I originally encountered this testing Ubuntu 25.10, but I can replicate it with the latest from git (c5554ab9) installed to ~/.cargo/bin/coreutils.
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
Reproduce the supplied shell example as a non-root user with supplementary group membership, comparing gnutest and the Rust coreutils test command. Start at the test command entry point and trace how readable permissions are evaluated. Done means test -r returns the same result as GNU coreutils for access granted through a supplementary group.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100