I see misbehaviour of new bsd grep in freebsd on tmpfs when grepping dirs.
For example (on tmpfs /tmp):
mkdir /tmp/qwe
grep something /tmp/qwe
(grep hangs)
When doing the same thing on ordinary filesystem (tried zfs and ufs), all works
correct (grep exits immediately).
I think this is easilly reproducible, but if you want me to submit additional
info on fill a PR, please tell.
I'm not sure though, what is the root of error: tmpfs or grep.
But grep at least should catch a error.
kdumps follows:
on TMPFS:
11651 grep CALL stat(0x5072e0,0x7fffe3e0)
11651 grep NAMI "/tmp/qwe"
11651 grep STRU struct stat {dev=67174145, ino=12, mode=drwxr-xr-x ,
nlink=2, uid=1001, gid=0, rdev=4294967295, atime=1281378090, stime=1281378090,
ctime=1281378090, birthtime=1281378090, size=0, blksize=4096, blocks=0,
flags=0x0 }
11651 grep RET stat 0
11651 grep CALL fstat(0x3,0x7fffe2b0)
11651 grep STRU struct stat {dev=67174145, ino=12, mode=drwxr-xr-x ,
nlink=2, uid=1001, gid=0, rdev=4294967295, atime=1281378090, stime=1281378090,
ctime=1281378090, birthtime=1281378090, size=0, blksize=4096, blocks=0,
flags=0x0 }
11651 grep RET fstat 0
11651 grep CALL read(0x3,0x800c97000,0x1000)
11651 grep RET read -1 errno 21 Is a directory
11651 grep CALL read(0x3,0x800c97000,0x1000)
11651 grep RET read -1 errno 21 Is a directory
11651 grep CALL read(0x3,0x800c97000,0x1000)
11651 grep RET read -1 errno 21 Is a directory
...
(infinitely repeating this)
on ZFS:
11644 grep CALL stat(0x5072e0,0x7fffe3d0)
11644 grep NAMI "/var/tmp/qqq"
11644 grep STRU struct stat {dev=1533790729, ino=28792, mode=drwxr-xr-x ,
nlink=2, uid=1001, gid=0, rdev=0, atime=1281379360.263012178,
stime=1281379360.263012178, ctime=1281379360.263012178,
birthtime=1281379360.263012178, size=2, blksize=131072, blocks=1, flags=0x0 }
11644 grep RET stat 0
11644 grep CALL fstat(0x3,0x7fffe2a0)
11644 grep STRU struct stat {dev=1533790729, ino=28792, mode=drwxr-xr-x ,
nlink=2, uid=1001, gid=0, rdev=0, atime=1281379360.263012178,
stime=1281379360.263012178, ctime=1281379360.263012178,
birthtime=1281379360.263012178, size=2, blksize=131072, blocks=1, flags=0x0 }
11644 grep RET fstat 0
11644 grep CALL read(0x3,0x800c96000,0x2)
11644 grep GIO fd 3 read 2 bytes
0x 0300 |..|
11644 grep RET read 2
11644 grep CALL read(0x3,0x800c96000,0x2)
11644 grep GIO fd 3 read 0 bytes
""
11644 grep RET read 0
11644 grep CALL close(0x3)
11644 grep RET close 0
on UFS:
11887 grep CALL stat(0x7fffea19,0x7fffe5d0)
11887 grep NAMI "/ufs_dir"
11887 grep STRU struct stat {dev=75, ino=95002, mode=drwxr-xr-x ,
nlink=2, uid=0, gid=0, rdev=378445, atime=1281381614, stime=1281381575,
ctime=1281381575, birthtime=-1, size=512, blksize=16384, blocks=4, flags=0x0 }
11887 grep RET stat 0
11887 grep CALL open(0x7fffea19,O_RDONLY,0x1b6)
11887 grep NAMI "/ufs_dir"
11887 grep RET open 3
11887 grep CALL stat(0x5072e0,0x7fffe3e0)
11887 grep NAMI "/ufs_dir"
11887 grep STRU struct stat {dev=75, ino=95002, mode=drwxr-xr-x ,
nlink=2, uid=0, gid=0, rdev=378445, atime=1281381614, stime=1281381575,
ctime=1281381575, birthtime=-1, size=512, blksize=16384, blocks=4, flags=0x0 }
11887 grep RET stat 0
11887 grep CALL fstat(0x3,0x7fffe2b0)
11887 grep STRU struct stat {dev=75, ino=95002, mode=drwxr-xr-x ,
nlink=2, uid=0, gid=0, rdev=378445, atime=1281381614, stime=1281381575,
ctime=1281381575, birthtime=-1, size=512, blksize=16384, blocks=4, flags=0x0 }
11887 grep RET fstat 0
11887 grep CALL read(0x3,0x800c9a000,0x4000)
11887 grep GIO fd 3 read 512 bytes
0x 1a73 0100 0c00 0401 2e00 0200 f401 0402 2e2e
|.s|
0x001e
|..|
0x003c
|..|
0x005a
|..|
0x0078
|..|
0x0096
|..|
0x00b4
|..|
0x00d2
|..|
0x00f0
|..|