Skip to content

"test" does not use access syscall for testing permissions #13197

Description

@jelly

Unlike the GNU implementation of coreutils uutils doesn't use access which means ACL's are not taking into account or that root can write into a users home directory:

A simple reproducer:

root@ubuntu:~# ls -lh /home/admin/test.txt
-rw-r--r-- 1 admin admin 4 Jun 29 08:14 /home/admin/test.txt
root@ubuntu:~# test -w /home/admin/test.txt && echo 'write'
write
root@ubuntu:~# /usr/lib/cargo/bin/coreutils/test -w /home/admin/test.txt && echo "write"
root@ubuntu:~#
root@ubuntu:~# /usr/bin/gnutest -w /home/admin/test.txt  && echo "write"
write

This issue is reproducible on Ubuntu 26.04 with uutils 0.8.0. The Git main version does not use the access syscall so still suffers from the same issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions