Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 184291 - scanelf-packagecheck (potential app-portage/gentoolkit: revdep-rebuild replacement)
Summary: scanelf-packagecheck (potential app-portage/gentoolkit: revdep-rebuild replac...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Portage Tools Team
Depends on:
Blocks: 346443
  Show dependency tree
Reported: 2007-07-05 13:07 UTC by
Modified: 2015-03-05 22:13 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---

scanelf-packagecheck-0.01 (,4.65 KB, text/plain)
2007-07-05 13:07 UTC,
scanelf-packagecheck.addcomments-argchecking.patch (scanelf-rebuild.addcomments-argchecking.patch,6.55 KB, patch)
2007-07-05 15:49 UTC,
Details | Diff
scanelf-packagecheck.patch (scanelf-packagecheck.patch,7.01 KB, patch)
2007-07-06 00:17 UTC,
Details | Diff (,42.71 KB, application/octet-stream)
2007-07-07 22:07 UTC,
scanelf-packagecheck-0.04.bash (scanelf-packagecheck-0.04.bash,8.27 KB, text/plain)
2007-10-11 15:42 UTC,
scanelf-packagecheck-0.04-0.05.patch (scanelf-packagecheck-0.04-0.05.patch,1.06 KB, patch)
2007-10-12 03:24 UTC,
Details | Diff
scanelf-packagecheck-0.06 (scanelf-packagecheck-0.06.bash,8.42 KB, text/plain)
2007-11-12 04:03 UTC,

Note You need to log in before you can comment on or make changes to this bug.
Description 2007-07-05 13:07:05 UTC
This is an incomplete, but functional script that I hope will one day replace revdep-rebuild. It uses scanelf instead of ldd, and outputs portage-compatible package lists to stdout, so you can pipe it to any package manager.

It's also quite a bit faster than revdep-rebuild, and doesn't use any tempfiles.
Comment 1 2007-07-05 13:07:39 UTC
Created attachment 123953 [details]

Please let me know if you think I'm headed in the right direction or going the wrong way.
Comment 2 Marius Mauch (RETIRED) gentoo-dev 2007-07-05 14:53:07 UTC
A few code comments wouldn't hurt ... At least a simple description for each function.
Comment 3 2007-07-05 15:49:28 UTC
Created attachment 123972 [details, diff]

1) added comments
2) --quiet works
3) enforces required arguments to commandline parameters
4) hid -L option until I have time to implement it.
Comment 4 Paul Varner (RETIRED) gentoo-dev 2007-07-05 18:15:46 UTC
So far it looks fine to me and I don't think that you are headed in the wrong direction. 

pvarner@beldin ~/src/revdep-rebuild $ -bl
Dynamic linking is consistent
No dependencies missing from .la files
pvarner@beldin ~/src/revdep-rebuild $ -b -l
./ line 146: shift: -1: shift count out of range
Dynamic linking is consistent
Comment 5 SpanKY gentoo-dev 2007-07-05 22:23:46 UTC
i'd use `type -P` rather than `hash`

shouldnt these checks:
[[ avoid_utils != *.....

actually be:
[[ ${avoid_utils} != *.....
Comment 6 2007-07-06 00:17:22 UTC
Created attachment 124023 [details, diff]

Thanks! Fixed the bugs mentioned in comment #4 and comment #5. For the record if you want to use getopts in a function, make all of getopts' variables local or manually reset them, or you will not be able to call the function twice.
Comment 7 2007-07-06 00:21:51 UTC
(In reply to comment #5)
> i'd use `type -P` rather than `hash`

Meant to ask why... Why?
Comment 8 SpanKY gentoo-dev 2007-07-06 04:11:33 UTC
`type` is in POSIX (although -P is not), so you tend to see `type` or `which` in scripts ... honestly, i dont think ive ever seen `hash`

some other notes:
 - why reimplement die/warn funcs rather than using /etc/init.d/ ?
 - you can indent cat by doing (make sure you tab indent everything):
    cat <<-EOF
 - might have to get some feedback for BSD users about `find` usage and such ...
Comment 9 2007-07-06 13:57:51 UTC
(In reply to comment #8)
> `type` is in POSIX (although -P is not), so you tend to see `type` or `which`
> in scripts ... honestly, i dont think ive ever seen `hash`

hash is POSIX and I prefer its syntax and output ever-so-slightly more than type. I don't think 'which' is POSIX.

> some other notes:
>  - why reimplement die/warn funcs rather than using /etc/init.d/
To be honest, I didn't use /etc/init.d/ because I didn't know about it. I'm still having doubts about using it because it's a lot of stuff I won't use, and I only need those two functions.

>  - you can indent cat by doing (make sure you tab indent everything):
>     cat <<-EOF
>     foo
>     EOF
I just learned this syntax recently, and I like it a lot, but I don't want to use it for print_usage() because it's easier to eyeball the output for wrapping at column 80 without it.

>  - might have to get some feedback for BSD users about `find` usage and such

There are two ways I'm using find that aren't POSIX compliant. One is -print0, and that is entirely superfluous, so I'll remove it. (If there are ever any spaces in filenames in vdb I'm sure this isn't the only program that'll break.) The other is multiple /path/ arguments, about which POSIX is not too clear. I'm not sure how to avoid multiple path arguments except an expensive loop, and I'm pretty sure all Gentoo finds including the BSD ones will support multiple path args.

Speaking of POSIX, I know the script uses a lot of bashisms. Every time I go to sh-ize it I realize I should just write it in python. Unfortunately I suck at python, and am pretty good at bash, so I get stuck. :( Hopefully I'll remedy this at some point.
Comment 10 SpanKY gentoo-dev 2007-07-06 15:20:51 UTC
`which` is not POSIX

the point of exposing /etc/init.d/ to users is so that Gentoo scripts have a semi-standard output format ... you inherit it and use `eerror` and it looks the same as everyone else using `eerror`.  even if you only use one or two functions, please use it.

just because existing utilities have whitespace limitations does not mean future ones should ... we've been making exceptions for `-print0 | xargs -0` because of this and because all the ports we support includes this functionality

writing the script in pure bash is OK so long as you use #!/bin/bash at the top so dont worry about trying to re-implement in #!/bin/sh ... especially considering i doubt you'll get a noticeable speedup: the disk I/O here will take much much longer
Comment 11 2007-07-07 20:29:17 UTC
I'm having trouble replicating a relatively recent addition to revdep-rebuild functionality with scanelf. For example:

$ ldd /opt/sun-jdk-
/opt/sun-jdk- /usr/lib/ no version information available (required by /opt/sun-jdk- =>  (0xb7fe4000) => not found => /usr/lib/ (0xb7faf000) => /lib/ (0xb7f99000) => /lib/ (0xb7e78000)
        /lib/ (0x80000000)

How might I get scanelf to tell me there's a problem with /opt/sun-jdk-, and dev-java/sun-jdk:1.4 should be rebuilt?
Comment 12 SpanKY gentoo-dev 2007-07-07 21:44:41 UTC
that output to me says /usr/lib/ is broken, not /opt/sun-jdk- ...

can you post those two libraries from your system so i can poke em ?
Comment 13 2007-07-07 22:07:58 UTC
Created attachment 124181 [details]

$ tar -tjf

Thanks, vapier, poke away.

I noted was a symlink to, so I included that file instead.
Comment 14 Paul Varner (RETIRED) gentoo-dev 2007-07-10 21:46:52 UTC
On my very broken test system, revdep-rebuild produces:
 * Checking dynamic linking consistency
[ 16% ]  *   broken /usr/bin/gpg-agent (requires
[ 16% ]  *   broken /usr/bin/gpgsm (requires
[ 22% ]  *   broken /usr/bin/nautilus (requires
[ 22% ]  *   broken /usr/bin/nautilus-connect-server (requires
[ 22% ]  *   broken /usr/bin/nautilus-file-management-properties (requires
[ 92% ]  *   broken /usr/libexec/battstat-applet-2 (requires
[ 94% ]  *   broken /usr/libexec/gnome-screensaver/floaters (requires
[ 94% ]  *   broken /usr/libexec/gnome-screensaver/popsquares (requires
[ 94% ]  *   broken /usr/libexec/gnome-screensaver/slideshow (requires
[ 95% ]  *   broken /usr/libexec/vino-server (requires
[ 100% ]                 
 *   broken /usr/lib/ (no version information available)
 *   broken /usr/lib/ (no version information available)

scanelf-rebuild produces:
# ./ -b
Dynamic linking is consistent
Comment 15 SpanKY gentoo-dev 2007-07-10 21:57:35 UTC
it's questionable whether re-emerging the package in question would even "fix" the issue.  a more interesting question is where did that version information go ?
Comment 16 2007-08-08 13:29:08 UTC
I'm hoping to get a little more feedback on this package -- where it should head feature-wise, what improvements I can make in terms of usability and speed, and most importantly how I can make better use of scanelf.

Any input would be most welcome. :)
Comment 17 2007-10-11 15:42:07 UTC
Created attachment 133151 [details]

This one is much more sophisticated than earlier versions -- among other things it masks libs like and counterparts (right now it uses /etc/revdep-rebuild/* for this).

It also allows you to specify your package manager and have some control over the output noisiness.
Comment 18 2007-10-11 16:16:21 UTC
If the qatom bug described in bug #166767 pops up it will break scanelf-packagecheck.
Comment 19 2007-10-12 03:24:33 UTC
Created attachment 133229 [details, diff]

Some bug fixes:

- accidentally capitalized "paludis" where I shouldn't've
- checks for dependency on portage-utils (q)
Comment 20 2007-11-12 04:03:16 UTC
Created attachment 135793 [details]

This version doesn't use qatom, so isn't susceptible to the blocker bug anymore...
Comment 21 2007-11-12 04:03:38 UTC
Removed blocker.
Comment 22 solar (RETIRED) gentoo-dev 2008-05-11 06:14:36 UTC
(In reply to comment #18)
> If the qatom bug described in bug #166767 pops up it will break
> scanelf-packagecheck.
That should also no longer be a problem.
Comment 23 Paul Varner (RETIRED) gentoo-dev 2011-07-21 05:07:40 UTC
revdep-rebuild is being rewritten to utilize scanelf, so this will eventually get resolved as wontfix or obsolete.  However, I'm making it block the gentoolkit-0.3.1 Tracker bug, since the logic in the script can be useful as the replacement is being rewritten.