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

Bug#640325: faccessat broken for user root?



Hi!

Petr Salinger <Petr.Salinger@seznam.cz> writes:
> 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.

  So relying on this is actually a bug in dash? (and there's probably no
easy way to check how faccessat is behaving right?)

Thanks for your information!

    Christoph

-- 
9FED 5C6C E206 B70A 5857  70CA 9655 22B9 D49A E731
Debian Developer | Lisp Hacker | CaCert Assurer



Reply to: