[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: OT: find command permissions: how to exclude dir?



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 herald:~/tmp/findtest]$ find . -print
.
./noread
find: `./noread': Permission denied
./read
./read/file

[gordon 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 bigdog ~]$ ls -lad .gv*
	dr-x------ 2 rick rick 0 2008-11-04 18:00 .gvfs
	[rick bigdog ~]$ find . -name ".gvfs" -prune -o -print \
	>/dev/null
	[rick bigdog ~]$

As root:
	[root bigdog rick]# find . -name ".gvfs" -prune -o -print \
	>/dev/null
	find: ./.gvfs: Permission denied
	[root bigdog rick]#

Note that test was on F9, x86_64.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer                      ricks 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           -
----------------------------------------------------------------------


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]