<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>194234</bug_id>
          
          <creation_ts>2007-09-30 00:10 0000</creation_ts>
          <short_desc>app-portage/gentoolkit-0.2.4_pre7: revdep-rebuild-rewrite&apos;s &quot;portable find&quot; function is slightly bogus</short_desc>
          <delta_ts>2008-02-21 01:52:11 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Portage Development</product>
          <component>Tools</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <keywords>InSVN</keywords>
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>170220</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>levertond@googlemail.com</reporter>
          <assigned_to>tools-portage@gentoo.org</assigned_to>
          <cc>michael@smith-li.com</cc>

      

      
          <long_desc isprivate="0">
            <who>levertond@googlemail.com</who>
            <bug_when>2007-09-30 00:10:53 0000</bug_when>
            <thetext>The &quot;find&quot; 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&apos;t executable, all the tests of find&apos;s syntax fail, and it falls through to the &quot;Last resort&quot; branch, which replaces -executable etc with &quot;-exec test ...&quot;.  This fails because all it does is cause the test command to be executed for each file - find doesn&apos;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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>levertond@googlemail.com</who>
            <bug_when>2007-09-30 00:12:56 0000</bug_when>
            <thetext>Created an attachment (id=132207)
patch

This fixes both issues: for the first, use $(type -P find) as the assumed-executable to test, since if it isn&apos;t executable then things are /really/ hopeless.  For the second, since no-one&apos;s complained before we can assume that no implementation of find requires the &quot;last resort&quot;, so we can just replace it with a die.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>michael@smith-li.com</who>
            <bug_when>2008-01-21 19:54:43 0000</bug_when>
            <thetext>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 &quot;-exec utility_name [argument...] ;&quot;, &quot;...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.&quot;  It&apos;s certainly possible my implementation was faulty, but the man page backs up the theory behind the &quot;Last Resort&quot; method. Is it possible that the failure you experienced had a different cause?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>levertond@googlemail.com</who>
            <bug_when>2008-01-21 21:03:36 0000</bug_when>
            <thetext>(In reply to comment #2)
&gt; As for the Last Resort branch, find(1p) claims that  for the syntax &quot;-exec
&gt; utility_name [argument...] ;&quot;, &quot;...the utility utility_name shall be invoked
&gt; once for each pathname and the primary shall evaluate as true if the utility
&gt; returns a zero value as exit status.&quot;

Yeah, sorry, I must have missed that part of the doc.

&gt; It&apos;s certainly possible my implementation was faulty, but the man page backs
&gt; up the theory behind the &quot;Last Resort&quot; method. Is it possible that the
&gt; failure you experienced had a different cause? 

In

&gt;	while read LIST; do
&gt;		break # Set LIST
&gt;	done &lt; &lt;(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.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>michael@smith-li.com</who>
            <bug_when>2008-01-22 22:15:03 0000</bug_when>
            <thetext>Created an attachment (id=141612)
revdep-rebuild_r453_find_find.patch

How does this patch look? I believe it should fix this bug.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>levertond@googlemail.com</who>
            <bug_when>2008-01-22 22:51:23 0000</bug_when>
            <thetext>(In reply to comment #4)
&gt; How does this patch look? I believe it should fix this bug.
&gt; 

Looks good to me.  Tested and it works fine here.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>fuzzyray@gentoo.org</who>
            <bug_when>2008-02-16 20:36:14 0000</bug_when>
            <thetext>$ svn commit -m &quot;Apply patch for revdep-rebuild portable find function. (Bug 194234)&quot;
Sending        revdep-rebuild/revdep-rebuild
Transmitting file data .
Committed revision 460.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>fuzzyray@gentoo.org</who>
            <bug_when>2008-02-21 01:52:11 0000</bug_when>
            <thetext>Released in gentoolkit-0.2.4_rc2</thetext>
          </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>132207</attachid>
            <date>2007-09-30 00:12 0000</date>
            <desc>patch</desc>
            <filename>revdep-rebuild.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIHJldmRlcC1yZWJ1aWxkLXJld3JpdGVfcHJlN34JMjAwNy0wOS0zMCAwMDo0Mjo1MC4wMDAw
MDAwMDAgKzAxMDAKKysrIHJldmRlcC1yZWJ1aWxkLXJld3JpdGVfcHJlNwkyMDA3LTA5LTMwIDAx
OjA0OjEzLjAwMDAwMDAwMCArMDEwMApAQCAtMTAwLDMwICsxMDAsMjUgQEAKICMgb2YgdmFyaW91
cyB2ZXJzaW9ucyBvZiAtcGVybSAvKyBibGFoIGJsYWggYW5kIGhhY2tzCiBmaW5kKCkgewogCWhh
c2ggZmluZCB8fCB7IGRpZSAxICdmaW5kIG5vdCBmb3VuZCEnOyB9Ci0JIyBXZSBjYW4gYmUgcHJl
dHR5IHN1cmUgIiQwIiBzaG91bGQgYmUgZXhlY3V0YWJsZS4KLQlpZiBbWyAkKGNvbW1hbmQgZmlu
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CQljb21t
YW5kIGZpbmQgIiR7YVtAXX0iCiAJCX0KLQllbHNlICMgTGFzdCByZXNvcnQKLQkJZmluZCgpIHsK
LQkJCWE9KCR7QC8vLWV4ZWN1dGFibGUvLWV4ZWMgdGVzdCAteCAne30nIFw7fSkKLQkJCWE9KCR7
YVtAXS8vLXdyaXRhYmxlLy1leGVjIHRlc3QgLXcgJ3t9JyBcO30pCi0JCQlhPSgke2FbQF0vLy1y
ZWFkYWJsZS8tZXhlYyB0ZXN0IC1yICd7fScgXDt9KQotCQkJY29tbWFuZCBmaW5kICIke2FbQF19
IgotCQl9CisJZWxzZQorCQlkaWUgMSAiZG9uJ3Qga25vdyBob3cgdG8gc2VhcmNoIGZvciBwZXJt
aXNzaW9ucyB3aXRoIGZpbmQiCiAJZmkKIAlmaW5kICIkQCIKIH0K
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>141612</attachid>
            <date>2008-01-22 22:15 0000</date>
            <desc>revdep-rebuild_r453_find_find.patch</desc>
            <filename>revdep-rebuild_r453_find_find.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIHJldmRlcC1yZWJ1aWxkX3I0NTMJMjAwOC0wMS0yMSAxNDozMDoxOS4wMDAwMDAwMDAgLTA1
MDAKKysrIHJldmRlcC1yZWJ1aWxkCTIwMDgtMDEtMjIgMTc6MDg6NTQuMDAwMDAwMDAwIC0wNTAw
CkBAIC03NiwxNyArNzYsMTggQEAKICMgb2YgdmFyaW91cyB2ZXJzaW9ucyBvZiAtcGVybSAvKyBi
bGFoIGJsYWggYW5kIGhhY2tzCiBmaW5kKCkgewogCWhhc2ggZmluZCB8fCB7IGRpZSAxICdmaW5k
IG5vdCBmb3VuZCEnOyB9Ci0JIyBXZSBjYW4gYmUgcHJldHR5IHN1cmUgIiQwIiBzaG91bGQgYmUg
ZXhlY3V0YWJsZS4KLQlpZiBbWyAkKGNvbW1hbmQgZmluZCAiJDAiIC1leGVjdXRhY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