Subject: Re: bug#21130: test fail: 'tests/ls/stat-failed'

From: Assaf Gordon <[email-masked]>
Date: Sat, 25 Jul 2015 18:43:03 -0400

Hello,

> On Jul 25, 2015, at 13:13, Pádraig Brady <[email-masked]> wrote:

>>>> On 24/07/15 22:46, Assaf Gordon wrote:
>>>>> Then tries to dereference it:
>>>>>      $ ls -Log d
>>>>>      ls: cannot access d/s: Permission denied
>>>>>      total 0
>>>>>      d????????? ? ?            ? s
> 
<...>

> Yes good point. So it must be that d_type is set to 'd' erroneously.
> What is the file system and operating system on the NFS server?

The NFS server is an Isilon OneFS (not sure which model/version).

strace gives:
  stat("d", {st_mode=S_IFDIR|0600, st_size=19, ...}) = 0
  open("d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3
  fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
  getdents(3, /* 3 entries */, 32768) = 72
  stat("d/s", 0x1fc9690) = -1 EACCES (Permission denied) 

Breaking in 'print_dir()' (ls.c:2612) gives:

---
##
## The code was "next = readdir(dirp)"
##
(gdb) p *next
$9 = {d_ino = 6682814318, d_off = 3, d_reclen = 24, d_type = 4 '\004',
  d_name = "s\000\000\000\004", '\000' <repeats 250 times>}
----
So it seems the filesystem reports d_type==DT_DIR.

For completeness, I've tested with other file types, and it seems that the returned type is always 'directory':
---
$ chmod 700 d
$ ls -log d
total 8
lrwxrwxrwx 1  9 Jul 25 18:29 blockdev -> /dev/sda1
lrwxrwxrwx 1  9 Jul 25 18:29 chardev -> /dev/tty0
lrwxrwxrwx 1 11 Jul 25 18:29 file -> /etc/passwd
lrwxrwxrwx 1  1 Jul 24 17:41 s -> /

$ ls -Log d
total 8
brw-rw----  1 8, 1 Dec 16  2014 blockdev
crw--w----  1 4, 0 Dec 16  2014 chardev
-rw-r--r--  1 1808 Jun 26 12:00 file
dr-xr-xr-x 26 4096 Jan 29 15:06 s

$ chmod 600 d
$ ls -Log d
ls: cannot access d/file: Permission denied
ls: cannot access d/chardev: Permission denied
ls: cannot access d/blockdev: Permission denied
ls: cannot access d/s: Permission denied
total 0
d????????? ? ?            ? blockdev
d????????? ? ?            ? chardev
d????????? ? ?            ? file
d????????? ? ?            ? s
---

regards,
 - assaf