First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 194234
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Portage Utilities Team <tools-portage@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: David Leverton <levertond@googlemail.com>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:

Filename Description Type Creator Created Size Actions
revdep-rebuild.patch patch patch David Leverton 2007-09-30 00:12 0000 1.43 KB Details | Diff
revdep-rebuild_r453_find_find.patch revdep-rebuild_r453_find_find.patch patch Michael A. Smith 2008-01-22 22:15 0000 1.40 KB Details | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 194234 depends on: Show dependency tree
Show dependency graph
Bug 194234 blocks: 170220
Votes: 0    Show votes for this bug    Vote for this bug

Additional Comments: (this is where you put emerge --info)







View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2007-09-30 00:10 0000
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.

------- Comment #1 From David Leverton 2007-09-30 00:12:56 0000 -------
Created an attachment (id=132207) [edit]
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.

------- Comment #2 From Michael A. Smith 2008-01-21 19:54:43 0000 -------
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?

------- Comment #3 From David Leverton 2008-01-21 21:03:36 0000 -------
(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.

------- Comment #4 From Michael A. Smith 2008-01-22 22:15:03 0000 -------
Created an attachment (id=141612) [edit]
revdep-rebuild_r453_find_find.patch

How does this patch look? I believe it should fix this bug.

------- Comment #5 From David Leverton 2008-01-22 22:51:23 0000 -------
(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.

------- Comment #6 From Paul Varner 2008-02-16 20:36:14 0000 -------
$ svn commit -m "Apply patch for revdep-rebuild portable find function. (Bug
194234)"
Sending        revdep-rebuild/revdep-rebuild
Transmitting file data .
Committed revision 460.

------- Comment #7 From Paul Varner 2008-02-21 01:52:11 0000 -------
Released in gentoolkit-0.2.4_rc2

First Last Prev Next    No search results available      Search page      Enter new bug