From 158acfca81619a3c2e7ba5c3842d8f9e0420a8a5 Mon Sep 17 00:00:00 2001 From: Gustavo De Nardin Date: Wed, 6 Jun 2007 21:26:02 +0000 Subject: Workaround for find strange behavior. Should finally fix bug #30315. --- lib/Youri/Repository.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Youri/Repository.pm b/lib/Youri/Repository.pm index cc02bbc..8aa9cb0 100644 --- a/lib/Youri/Repository.pm +++ b/lib/Youri/Repository.pm @@ -305,7 +305,12 @@ sub get_files { my $grep = ""; $grep = "-regextype posix-egrep -regex '.*\/$pattern'" if ($pattern); - my @files = map { chop; $_; } `find -L $root/$path $grep -type f`; + # XXX: run find in a directory the user is guaranteed to have read + # permissions! find simply exits with error if the user doesn't have + # read permission on the *current* dir; as this code is run thru many + # sudo invocations, sometimes the user calling it has $HOME chmoded to + # 0700, making find fail when run as mandrake + my @files = map { chop; $_; } `cd && find -L $root/$path $grep -type f`; die "FATAL: get_files(): find failed!" if ($?); return @files; -- cgit v1.2.1