Problem with find -prune...

看板FB_hackers作者時間17年前 (2008/03/24 13:19), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/3 (看更多)
find -prune seems to not quite do what it says. At least, when delete is used. Here's an example tree (on 7.0-RELEASE, amd64 build): bhuda# ls -Rl /tmp/x total 2 drwx------ 2 root wheel 512 Mar 24 01:01 y /tmp/x/y: total 2 -rw-r--r-- 1 root wheel 1111 Mar 24 01:01 motd /tmp/x contains a subdirectory closed to everyone but root, which has a file in it. No problem. Point find at it as a user: bhuda% find /tmp/x -print /tmp/x /tmp/x/y find: /tmp/x/y: Permission denied As expected, it complains. Now let's use prune to trim the search - at the root of the tree: bhuda% find /tmp/x -prune /tmp/x Hmm, it prints the root of the tree. That might be a bug; might not. But we can fix it with a little tweak: bhuda% find /tmp/x -prune -o -print bhuda% Making the print conditional on not pruning, and we always prune. Ok, now let's look at what looks to me like a bug: bhuda% find /tmp/x -prune -o -delete find: /tmp/x/y: Permission denied Why on earth (or off it) is find trying to look at /tmp/x? Am I correct in assuming that this is a bug? Thanks, <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
文章代碼(AID): #17vpdg00 (FB_hackers)
文章代碼(AID): #17vpdg00 (FB_hackers)