The "find" function in revdep-rebuild-rewrite assumes that the script itself will have the executable bit. While this is true when it is installed from an ebuild, it may not be when, for example, downloading the latest version of the script from viewvc with a web browser. This leads to the second issue: if the script isn't executable, all the tests of find's syntax fail, and it falls through to the "Last resort" branch, which replaces -executable etc with "-exec test ...". This fails because all it does is cause the test command to be executed for each file - find doesn't do anything with the return value. If the actual call to find specifies an explicit action it well be executed regardless of whether the file is actually executable, otherwise the default -print action will /not/ be executed at all.
Created attachment 132207 [details, diff] patch This fixes both issues: for the first, use $(type -P find) as the assumed-executable to test, since if it isn't executable then things are /really/ hopeless. For the second, since no-one's complained before we can assume that no implementation of find requires the "last resort", so we can just replace it with a die.
In reply to comment #0: Hi, David, I agree that testing the executability of $(type -P find) is more appropriate than testing $0. As for the Last Resort branch, find(1p) claims that for the syntax "-exec utility_name [argument...] ;", "...the utility utility_name shall be invoked once for each pathname and the primary shall evaluate as true if the utility returns a zero value as exit status." It's certainly possible my implementation was faulty, but the man page backs up the theory behind the "Last Resort" method. Is it possible that the failure you experienced had a different cause?
(In reply to comment #2) > As for the Last Resort branch, find(1p) claims that for the syntax "-exec > utility_name [argument...] ;", "...the utility utility_name shall be invoked > once for each pathname and the primary shall evaluate as true if the utility > returns a zero value as exit status." Yeah, sorry, I must have missed that part of the doc. > It's certainly possible my implementation was faulty, but the man page backs > up the theory behind the "Last Resort" method. Is it possible that the > failure you experienced had a different cause? In > while read LIST; do > break # Set LIST > done < <(find $HOME/ /var/tmp/ /tmp/ -writable) when the last resort method is used, the use of -exec suppresses the default -print, causing find not to output anything. It seems to work fine if the -print is specified explicitly, so that would be better than what I suggested before.
Created attachment 141612 [details, diff] revdep-rebuild_r453_find_find.patch How does this patch look? I believe it should fix this bug.
(In reply to comment #4) > How does this patch look? I believe it should fix this bug. > Looks good to me. Tested and it works fine here.
$ svn commit -m "Apply patch for revdep-rebuild portable find function. (Bug 194234)" Sending revdep-rebuild/revdep-rebuild Transmitting file data . Committed revision 460.
Released in gentoolkit-0.2.4_rc2