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

Re: ITP: libsafe (again, and need a sponsor...)

On Wed, Jun 14, 2000 at 03:02:45PM +0200, Ron Rademaker wrote:
> I did write the script in a way it uses only the essential packages (perl,
> rm and touch, AFAIK available on every system), currently I've made it a
> debian package, if you would like to take a look at the script, you can
> find it on my ftp-site:

No, the build process uses these things, whereas the runtime package
uses only perl (plus whatever ends up in any maintainer scripts,
specifically rm and ln).

> ftp://rademaker.dhs.org
> it's in pub/linux/debian/packages
> the .deb is in binary-i386 (actually this perl script is usable on any
> arch) and the sources in sources (duh...)

A few quick points about the packaging:

(1) This is currently a native Debian package, right?  So it doesn't
    make sense to have an .orig.tar.gz and a .diff file.  Just have a
    version number something like "2.2" and be done with it.  If
    you're planning to have a main upstream version with the Debian
    package just one way of doing it, you could use your scheme.

(2) In the orig.tar.gz, stick everything inside a directory, rather
    that in a top level directory.

(3) Why are there two (slightly different) copies of the manpage

(4) Get rid of all of the .ex files which aren't used from the debian/
    directory.  They're just plain confusing.

(5) You don't need to depend upon perl-base; it's essential.

(6) Architecture: all if it's got no compiled code in it.

(7) You don't need to list manpage directories in debian/dirs; they're
    created automatically.

(8) This program is going in /usr/sbin, so it's manpage should go in
    section 8, not section 1.

(9) The rules file is based on the example rules file, but should
    probably be based on the rules.indep file, as you are making an
    architecture independent package.

(10) The build process uses debhelper, and you claim to be fulfilling
     policy 3.1.1 in the control file, so you must have a line:
       Build-Depends-Indep: debhelper
     in the first section on the control file.  (-Indep for when you
     make it an "Architecture: all" package.)

(11) It's a bad thing to leave blank lines within sections of a
     Makefile (such as debian/rules): it's not at all clear that the
     section continues, as tabs are invisible.

(12) Why are you doing chmod 755 ... after dh_fixperms?  It doesn't
     strip the execute bit of programs....

(13) The clean target could use rm -rf instead of rm -r.  It must also
     remove the configure-stamp and build-stamp files.  And rather
     than remove the tmp dir yourself, why not use the standard idiom
     found in sample rules file, using dh_clean?

(14) You could consider using install instead of cp.

(15) debian/files shouldn't be in the diff file.  I don't think you
     cleaned the build tree (debian/rules clean) before you created
     the diff file.

Next, it only runs interactively.  That's not acceptable for such a

You don't check that the library name is absolute.

And last but not least, you *must* work with a temporary file until
everything's correct, and only then replace the original
ld.so.preload file.  Otherwise you could end up wiping out the
original information.  You should probably also save a backup to
ld.so.preload.orig or similar.

Bare bones (untested) rewrite in shell:

#! /bin/sh

usage() {
    echo "This is how you use me"

if [ $# -lt 1 ]; then usage >&2; exit 1; fi
# Maybe test for --help etc here

if [ "x$1" eq "x-r" ]; then add=no; shift; fi
if [ $# -ne 1 ]; then usage >&2; exit 1; fi

case "$1" in
    /*) # This is OK
     *) # This isn't
        echo "Library names must be absolute!" >&2
        exit 1 ;;

if [ ! -f "$1" ]; then echo "Can't find requested library" >&2; exit 0; fi

if [ $add = yes ]; then
    if [ -f /etc/ld.so.preload ]; then
        cp /etc/ld.so.preload /etc/ld.so.preload.new
        echo "$1" >> /etc/ld.so.preload.new
        cp /etc/ld.so.preload /etc/ld.so.preload.orig
        mv /etc/ld.so.preload.new /etc/ld.so.preload
        echo "$1" > /etc/ld.so.preload
else  # to remove
    if [ ! -f /etc/ld.so.preload ]; then
        echo "/etc/ld.so.preload does not exist" >&2; exit 1;
    if ! grep -q "^$1\$" /etc/ld.so.preload; then
        echo "Libary $1 is not currently in /etc/ld.so.preload" >&2
        exit 1
    grep -v "^$1\$" /etc/ld.so.preload > /etc/ld.so.preload.new
    cp /etc/ld.so.preload /etc/ld.so.preload.orig
    mv /etc/ld.so.preload.new /etc/ld.so.preload

exit 0

Hope all of this is of some use.



  Julian Gilbey, Dept of Maths, QMW, Univ. of London. J.D.Gilbey@qmw.ac.uk
        Debian GNU/Linux Developer,  see http://www.debian.org/~jdg
  Donate free food to the world's hungry: see http://www.thehungersite.com/

Reply to: