Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 1638 - /bin/grep needs /usr/lib/libpcre.so.0
Summary: /bin/grep needs /usr/lib/libpcre.so.0
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: x86 Linux
: High minor (vote)
Assignee: Matthew Kennedy (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-10 00:34 UTC by Sandy McArthur
Modified: 2003-02-04 19:42 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sandy McArthur 2002-04-10 00:34:05 UTC
Some will disagree that this is a problem so hear me out to the end.

Run `ldd /bin/grep` and you'll get:
        libpcre.so.0 => /usr/lib/libpcre.so.0 (0x4002d000)
        libc.so.6 => /lib/libc.so.6 (0x40037000)
        /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

Everything looks ok? Well, IMO since grep is in /bin is should not depend on
anything in /usr . I keep /usr as a different mount point than my root
filesystem and if my machine were to have problems where I couldn't mount /usr
but could mount the root I would not be able to use the grep command during
recovery.

How would I solve this? 

I think anything in /bin should be statically compiled to improve the
probability of recovery when all goes to hell but that is a policy issue for
people more involved with Gentoo.

You could have two grep packages, grep and sgrep, kinda like there are two
python packages. sgrep would be staticly compiled and merge into /bin and grep
would be normally compiled and merge into /usr/bin . If you did this you would
probably want to make it so /usr/bin was before /bin in the user's $PATH .

Maybe just staticly compile the grep package but then you lose the advantage of
libs.

Or move /usr/lib/libpcre.so.0 to /lib/libpcre.so.0 but I don't like this idea.
Comment 1 Matthew Kennedy (RETIRED) gentoo-dev 2002-04-11 12:36:57 UTC
I can confirm this. When I shutdown my machine, the last thing before system
halt is a message about /usr/lib/libpcre.so.X missing. My /usr and / are on
different volumes. A quick ldd /bin/* shows that only grep is the looking for
something in /usr/lib.

There are a couple of solutions:

   1.  move libpcre into /lib
   2.  build /bin/grep without libprce
   3.  link libprce statically.

Some research shows that other distros (eg. redhat and debian) are not doing 1
or 3. option 2 is the best because we get a vanilla /bin/grep with no libpcre
but if the user wants a libpcre-grep, then dev-libs/libprce provides just that:
/usr/bin/pcregrep.
Comment 2 Seemant Kulleen (RETIRED) gentoo-dev 2002-04-11 21:27:03 UTC
OK, I think your solution #2 is best.  Here's what I would recommend, but it
needs testing (especially in a bootstrap environment).  

in the DEPEND section: perl?( libpcre )

and then in src_compile():

   use perl || myconf="${myconf} --disable-perl-regexp"

That should compile without libpcre if you build it with -perl in USE :)

Comment 3 Sandy McArthur 2002-04-12 11:34:28 UTC
I did a few test compiles and it seems there is no way to force a static compile
of grep. The perl regexp feature was just added in the last release so not much
out there is going to need it. I think changing the start of src_compile to:

src_compile() {
    local myconf
    myconf="--disable-perl-regexp"
    [ -z "`use nls`" ] && myconf="--disable-nls"
...etc...

would be the best solution.
Comment 4 Matthew Kennedy (RETIRED) gentoo-dev 2002-04-12 19:15:00 UTC
Fixed in CVS but masked (sys-apps/grep-2.5-r1) until more people test it.