Wed 15 Jul 2009 07:54:16 AM UTC, original submission:
the command "ls" can find a file that find cannot. I think that find should either find files of this type by default, or at least have an option to do so. From what I understand, find cannot find the file because it attempts to cd into the directory before listing, instead of just listing the directory. It is possible that you have permission to do one but not the other.
To reproduce the situation, please see the following commands and output:
root@system76-pc:/home/xinwei/bugreport# ls -l
total 4
d---r--r-- 2 root root 4096 2009-07-05 13:27 protected
root@system76-pc:/home/xinwei/bugreport# ls -l protected
total 0
-rw-r--r-- 1 xinwei xinwei 0 2009-07-05 13:27 canttouchthis
root@system76-pc:/home/xinwei/bugreport# exit
xinwei@system76-pc:~/bugreport$ ls -l protected/
ls: cannot access protected/canttouchthis: Permission denied
total 0
-????????? ? ? ? ? ? canttouchthis
xinwei@system76-pc:~/bugreport$ find ./ -name canttouchthis
xinwei@system76-pc:~/bugreport$ sudo !!
sudo find ./ -name canttouchthis
./protected/canttouchthis
xinwei@system76-pc:~/bugreport$
-----------------------------------------------------------
here is a copy of some further conversation on this exact topic:
Posted by James Youngman <jay@gnu.org>
OpenSolaris find doesn't either:
flare:~/tmp$ find ft/tmp -ls
347455 4 drwxr-xr-x 3 james 1001 4096 Jul 8 09:54 ft/tmp
347457 4 drw-r--r-- 2 james 1001 4096 Jul 8 09:54
ft/tmp/nonexecutable
find: cannot read dir ft/tmp/nonexecutable/: Permission denied
flare:~/tmp$ ls -l ft/tmp/nonexecutable
ft/tmp/nonexecutable/foo: Permission denied
total 0
$ find ft -print
ft
ft/tmp
ft/tmp/nonexecutable
find: cannot read dir ft/tmp/nonexecutable/: Permission denied
flare:~/tmp$ uname -a
SunOS flare.spiral-arm.org 5.11 snv_101b i86pc i386 i86xpv
Thank you
|