OT: find command permissions: how to exclude dir?
Rick Stevens
ricks at nerd.com
Wed Nov 5 17:42:07 UTC 2008
Gordon Messmer wrote:
> Rick Stevens wrote:
>> Gordon Messmer wrote:
>>> You need to tell find what to do with files not named .gvfs:
>>>
>>> find /users/tburns -name .gvfs -prune -o -print
>>
>> Will not work. As soon as the non-owner of .gvfs does a stat on the
>> directory, the error will be spit out. find must "stat()" any item
>> it finds to handle the remainder of the predicate and POP goes the
>> error.
>
> If -name is the first predicate, and you prune matches, find will not
> need to stat() the directory entry:
>
> [gordon at herald:~/tmp/findtest]$ find . -print
> .
> ./noread
> find: `./noread': Permission denied
> ./read
> ./read/file
>
> [gordon at herald:~/tmp/findtest]$ find . -name noread -prune -o -print
> .
> ./read
> ./read/file
Sorry, won't work for GVFS filesystem mountpoints. As soon as the
non-owner touches the inode, the error occurs. Just a couple of tests
(I'm redirecting stdout just to get rid of the stuff extraneous to the
discussion):
As owner:
[rick at bigdog ~]$ ls -lad .gv*
dr-x------ 2 rick rick 0 2008-11-04 18:00 .gvfs
[rick at bigdog ~]$ find . -name ".gvfs" -prune -o -print \
>/dev/null
[rick at bigdog ~]$
As root:
[root at bigdog rick]# find . -name ".gvfs" -prune -o -print \
>/dev/null
find: ./.gvfs: Permission denied
[root at bigdog rick]#
Note that test was on F9, x86_64.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer ricks at nerd.com -
- AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 -
- -
- Jimmie crack corn and I don't care...what kind of lousy attitude -
- is THAT to have, huh? -- Dennis Miller -
----------------------------------------------------------------------
More information about the fedora-list
mailing list