[Toybox] misleading ls error output
Rob Landley
rob at landley.net
Tue Oct 27 21:59:09 PDT 2015
On 10/23/2015 09:50 PM, enh wrote:
> "ls /some-directory-you-can't-access" claims the problem is a bad file
> descriptor...
>
> newfstatat(AT_FDCWD, "/data", {st_mode=S_IFDIR|0771, st_size=4096, ...}, 0) = 0
> openat(AT_FDCWD, "/data", O_RDONLY) = -1 EACCES (Permission denied)
> dup(-1) = -1 EBADF (Bad file descriptor)
> mprotect(0x7fb3a50000, 4096, PROT_READ|PROT_WRITE) = 0
> mprotect(0x7fb3a50000, 4096, PROT_READ) = 0
> write(2, "ls: ", 4ls: ) = 4
> write(2, "No /data", 8No /data) = 8
> write(2, ": Bad file descriptor", 21: Bad file descriptor) = 21
> write(2, "\n", 1
> ) = 1
In its defense, strace said bad file descriptor 3 lines earlier. :)
But yeah, we should catch that before the dup(). And I should apply the
O_PATH thing too. Hmmm... Ok, I've made a stab at it, but I don't have
an xattr test environment setup. Care tel tell me if it works?
Thanks,
Rob
1446008349.0
More information about the Toybox
mailing list