Linus, I have tried your suggestion with O_PATH, but if I use it in an
application, the shell built in 'cd', I get this error:
./arch/linux.i386-64/bin/ksh -c 'cd /etc ; true'
./arch/linux.i386-64/bin/ksh: cd: /etc: [Bad file descriptor]

strace reports that the file descriptor returned by openat(...,O_PATH)
can not be used for fchdir():
openat(AT_FDCWD, "/etc", O_RDONLY|O_CLOEXEC|0x200000) = 3
fchdir(3)                               = -1 EBADF (Bad file descriptor)

Is this intended or a Linux bug? The same code runs on Solaris, with
O_SEARCH replacing O_PATH, without problems, passing all tests for a
shell.

Linux version is:
uname -a
Linux chickenmonster 3.1.10-1.16-desktop #1 SMP PREEMPT Wed Jun 27
05:21:40 UTC 2012 (d016078) x86_64 x86_64 x86_64 GNU/Linux

Olga

On Fri, Jul 6, 2012 at 6:21 PM, ольга крыжановская
<[email protected]> wrote:
> Thanks. When was O_PATH added, where is the difference to O_SEARCH and
> what is the catch?
>
> Olga
>
> On Fri, Jul 6, 2012 at 6:16 PM, Linus Torvalds
> <[email protected]> wrote:
>> On Fri, Jul 6, 2012 at 8:18 AM, ольга крыжановская
>> <[email protected]> wrote:
>>>
>>> Linus, what was the motive for rejecting O_SEARCH?
>>
>> I haven't rejected it, and we have it. It's called O_PATH.
>>
>>                  Linus
>
>
>
> --
>       ,   _                                    _   ,
>      { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
> .----'-/`-/     [email protected]   \-`\-'----.
>  `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
>       /\/\     Solaris/BSD//C/C++ programmer   /\/\
>       `--`                                      `--`



-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     [email protected]   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to