Skip to content

The test command does not work properly #8960

Description

@sagitariozod

Hello.
I'm using Ubuntu 25.10, and I've detected a possible bug where the test command isn't working properly with ACLs. In Ubuntu 25.04, the command worked correctly.

The command is as follows, it should return 0 but it returns 1.
sudo -u usuariox test -w "/Datos/INFORMES 2026"; echo "$?"

In Ubuntu 25.04, the output was 0, and in Ubuntu 25.10, the output is 1.
User usuariox has write permissions with ACLs.

I have tried the gnutest command as an alternative and it works fine.
sudo -u usuariox gnutest -w "/Datos/INFORMES 2026"; echo "$?"

Please review it.

Thank you very much.

Activity

  1. jepler commented on Oct 27, 2025

    @jepler

    Reproduced in ubuntu:25.10 in docker; host computer is Debian Trixie amd64. acl and strace packages were added to the base system.

    root@7ce3adcd8cac:/# touch /tmp/permissions
    root@7ce3adcd8cac:/# setfacl -m u:ubuntu:w /tmp/permissions
    root@7ce3adcd8cac:/# sudo -u ubuntu /bin/test -w /tmp/permissions; echo $?
    1
    root@7ce3adcd8cac:/# sudo -u ubuntu /bin/gnutest -w /tmp/permissions; echo $?
    0
    

    It's just a guess, but permissions set with setfacl (or any other method beyond file mode) may not be consulted by uutils test.

    gnu test uses the access syscall which takes into account whatever permissions the OS will apply. uutils test uses statx and then presumably makes some checks related to the file's mode, owner & group, which gives an incomplete view of permissions on a modern Linux system.

    execve("/bin/gnutest", ["/bin/gnutest", "-w", "/tmp/permissions"], 0x7ffeb5769980 /* 14 vars */) = 0
    newfstatat(AT_FDCWD, "/tmp/permissions", {st_mode=S_IFREG|0664, st_size=0, ...}, 0) = 0
    access("/tmp/permissions", W_OK)        = 0
    

    vs

    execve("/bin/test", ["/bin/test", "-w", "/tmp/permissions"], 0x7fff11ecbb30 /* 14 vars */) = 0
    statx(AT_FDCWD, "/tmp/permissions", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL|STATX_MNT_ID, stx_attributes=0, stx_mode=S_IFREG|0664, stx_size=0, ...}) = 0
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions