tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

suggestion: pkg_add should stat all libs in REQUIRES, at least base libs



I saw a report of a core dump apparently from pkg_add, which I think was
a program run by INSTALL, which failed to find a base system lib,
because it was an X lib, and the person had not installed X sets.  While
it's an error to install binary packages with a base system not matching
the bulk build environment, catching it and having a better error
message would be better.

A semi-random snippet from the middle of:

$ find . -name \+BUILD_INFO | xargs cat | egrep REQUIRES= | egrep -v /usr/pkg |sort | uniq -c

  66 REQUIRES=/usr/X11R7/lib/libxcb-render.so.0
   5 REQUIRES=/usr/X11R7/lib/libxcb-shape.so.0
  72 REQUIRES=/usr/X11R7/lib/libxcb-shm.so.0
   8 REQUIRES=/usr/X11R7/lib/libxcb-sync.so.1
  12 REQUIRES=/usr/X11R7/lib/libxcb-xfixes.so.0
   1 REQUIRES=/usr/X11R7/lib/libxcb-xinerama.so.0
   1 REQUIRES=/usr/X11R7/lib/libxcb-xinput.so.0
   2 REQUIRES=/usr/X11R7/lib/libxcb-xkb.so.1
 166 REQUIRES=/usr/X11R7/lib/libxcb.so.2
   3 REQUIRES=/usr/X11R7/lib/libxkbfile.so.2
   8 REQUIRES=/usr/X11R7/lib/libxshmfence.so.1
   9 REQUIRES=/usr/lib/libarchive.so.5
  69 REQUIRES=/usr/lib/libasn1.so.10
   2 REQUIRES=/usr/lib/libblocklist.so.0
 177 REQUIRES=/usr/lib/libbz2.so.1
 617 REQUIRES=/usr/lib/libc.so.12
  69 REQUIRES=/usr/lib/libcom_err.so.8
  29 REQUIRES=/usr/lib/libcrypt.so.1
 113 REQUIRES=/usr/lib/libcrypto.so.15
  14 REQUIRES=/usr/lib/libcurses.so.9

The concrete suggestion is for pkg_add, before commmiting to add a
package, to:

  - extract the REQUIRES list of libs
  - for each lib that is not in $LOCALBASE
      stat the lib
      throw an exception if missing

where the exception looks to the user something like:

  Can't install foo-1.2.3: This package needs /usr/X11R7/lib/libxcb.so.2
  be present, but it is not present on this system.

And perhaps extend that to all libs.  Allow -f to install anyway after
printing the error message as a warning.

On one system I checked, I have 1296 packages and 14076 total REQUIRES
lines.  I would suggest that 14076 stat calls is tiny compared to the
total work to install 1296 packages, and that an average of say 12 stats
per pkg_add will not be noticed.  But, it would add a lot of safety, and
help people that didn't install X sets.


Does anybody think this is a bad idea, or other comments?

Does anybody want to implement it?




Home | Main Index | Thread Index | Old Index