1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Find installed ports depending on one particular library

Discussion in 'Installation and Maintenance of Ports or Packages' started by mecano, May 9, 2012.

  1. mecano

    mecano Member

    Messages:
    127
    Thanks Received:
    7
    With the OpenSSL security and after updating, one needs to update ports that are depending on libcrypto(3).
    Do you have recipies for doing it automatically? I was thinking of using pkg_info -aI with ldd -v then a grep libcrypto but it looks like pkg_info does not output only package names so you may have to use awk to clean the output. Not a very elegant solution, I'm sure there should be better options.
     
  2. kpa

    kpa Well-Known Member

    Messages:
    4,109
    Thanks Received:
    812
    Note the wording "which are statically linked to libcrypto(3)". Any port (any binary in fact) that links libcrypto using dynamic linking does not need recompiling unless there's a version bump in the dynamic link library and I don't that the case with this update.

    Edit: There have been updates to both the base system libcrypto and the port security/openssl, which one you're using?
     
    mecano thanks for this.
  3. mecano

    mecano Member

    Messages:
    127
    Thanks Received:
    7
    Thanks to point this out kpa.
    I was talking of FreeBSD-SA-12:01.openssl.asc.
    The question is still interresting, how to find installed ports that are depending on a library given it name?
     
  4. kpa

    kpa Well-Known Member

    Messages:
    4,109
    Thanks Received:
    812
    This is adapted from ldd(1) manual page, it will print out names of ELF binaries in /usr/local/s?bin and and dynamic link libraries the binaries depend on.

    # find /usr/local/bin /usr/local/sbin -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A %p\n'


    You can then use # pkg_info -W file to figure out to which port a certain file belongs to.

    So it becomes something like this:
    # find /usr/local/bin /usr/local/sbin /usr/local/libexec -type f | xargs -n1 file -F ' ' | grep ELF | cut -f1 -d' ' | xargs ldd -f '%A\t%p\n' | grep '/lib/libcrypt.so.5$' | cut -f 1 | xargs -n1 pkg_info -W



    That's starting to smell like a useful script ;)
     
    wblock@ and mecano thanked for this.
  5. mecano

    mecano Member

    Messages:
    127
    Thanks Received:
    7
    I have no example part in my ldd(1) manual. Time to jump to FreeBSD 8 I guess. And it works great! Thanks kpa.

    What about statically linked libraries in ports as you pointed out? How to find ports that are statically linked to a particular lib?
     
  6. kpa

    kpa Well-Known Member

    Messages:
    4,109
    Thanks Received:
    812
    That's a tough one, there may not be any real version information that is carried over from the static link library to the linked binary. I would first try to find out if there are any version strings in the static link library with strings(1) that could be used for comparison and then try to find the same strings in the binaries.
     
  7. kpa

    kpa Well-Known Member

    Messages:
    4,109
    Thanks Received:
    812
    Note that the above "script" may not be useful for finding out broken dynamic link library dependencies in ports/packages, for that there's a very handy tool pkg_libchk(1) in sysutils/bsdadminscripts.
     
  8. mecano

    mecano Member

    Messages:
    127
    Thanks Received:
    7
    Thanks kpa for your time and valuable informations will look further these paths.
     
  9. jef

    jef New Member

    Messages:
    64
    Thanks Received:
    1
    pkg_libchk(1) shaved my butt when I read UPDATING but it didn't indicate that openssl.so was changing revision numbers.

    (yes, I'm leaving the typo)