uutils / uutils/coreutils

'test -r' returns wrong exit code for permissions granted by supplementary group membership

Open
#9,147 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

U - test
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.