[LTP] fs/acl: Add ACL_USER_OBJ permission test

Andrea Cervesato andrea.cervesato@suse.com
Mon Jun 15 11:04:05 CEST 2026


Hi Sachin,

> 
> The errno check for EOPNOTSUPP happens after acl_free() and
> cleanup_testfile(). cleanup_testfile() calls unlink() internally,
> and POSIX does not guarantee that errno is preserved after a
> successful syscall. If unlink() clobbers errno, the EOPNOTSUPP
> check silently fails and the test reports TBROK instead of TCONF.
> 
> test_chmod_acl() in the same file checks errno first:
> 
>     if (acl_set_file(...) < 0) {
>         if (errno == EOPNOTSUPP) {
>             acl_free(acl);
>             cleanup_testfile();
>             tst_brk(TCONF | TERRNO, ...);
>         }
>         acl_free(acl);
>         cleanup_testfile();
>         tst_brk(TBROK | TERRNO, ...);
>     }
> 
> Could test_chown_acl() use the same pattern?

This is correct, but it's also true that TERRNO is printing
errno with its description, so the example is wrong. If any
syscall after acl_set_file() will fail, we will print the errno
of rmdir() or unlink().

You need to save the errno using TEST().

Also, please don't define SAFE_* macros inside the tests, their
are part of the core library and they should not be defined out
of it. Instead, use inline functions.

Regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list