[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#640325: faccessat broken for user root?



severity 640325 wishlist
--

 The following code (extracted from dash's test builtin) is behaving
differently between linux and kfreebsd, having a 644 `test' file and
running it on linux as root user prints -1 while on kfreebsd it prints
0.

-------------------------------------------------------
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>

int main () {
 printf("%d\n", faccessat(AT_FDCWD, "test", X_OK, AT_EACCESS));
}
-------------------------------------------------------

While the behaviour is strange, it is still POSIX conforming:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html

If any access permissions are checked, each shall be checked individually, as described in XBD File Access Permissions, except that where that description refers to execute permission for a process with appropriate privileges, an implementation may indicate success for X_OK even if execute permission is not granted to any user.

We already wrap access syscall to more intuitive behaviour,
we should try to do the same also for faccessat.

Petr



Reply to: