OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
From: Marc Espie (espie_at_nerim.net)
Date: Sat Jan 18 2003 - 08:40:12 CST

  • Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

    This one is similar in spirit to an old change by fgs.
    It allows ld.so to use the main program's path to look up
    dependent libraries.

    Specifically, a.out libraries don't store any rpath.
    But some systems want to pull tricks like this. Example from kde:

    /usr/local/lib/libkaboodle.so.0.0 is linked against
    /usr/local/lib/kde3/libkaboodlepart.so.0.0, and libtool
    tries to -rpath /usr/local/lib/kde3

    Then the actual application kaboodle links against
    /usr/local/lib/libkaboodle.so.0.0 and
    /usr/local/lib/kde3/libkaboodlepart.so.0.0, and again, libtool fills in
    -rpath /usr/local/lib/kde3

    But without the following patch, kaboodle fails to load! Why ? because
    libkaboodle.so.0.0 will try to load libkaboodlepart.so.0.0 and will fail!
    even though the main application has specified it should look into
    /usr/local/lib/kde3.

    This patch fixes it, by requiring that the app looks into mainpath for
    dependent libraries, when it doesn't find them elsewhere.

    It actually fixes the few kde packages that used to actually require an
    ldconfig /usr/local/lib/kde3 to run...

    (This is independent from my previous patch, and can be tested after it)

    --- rtld.c Sat Jan 18 15:29:19 2003
    +++ rtld.c.new Sat Jan 18 15:28:53 2003
    -623,6 +623,16 again:
                     if (ipath)
                             remove_search_path(ipath);
     
    + if (path == NULL && smp != main_map && main_map != NULL &&
    + !no_intern_search &&
    + LD_PATHS(main_map->som_dynamic) != 0) {
    + ipath = LM_PATHS(main_map);
    + add_search_path(ipath);
    + path = rtfindlib(name, sodp->sod_major,
    + sodp->sod_minor, &usehints, ipath);
    + remove_search_path(ipath);
    + }
    +
                     if (path == NULL) {
                             errno = ENOENT;
                             return NULL;