tag 376501 patch
thanks

Attached is a patch to fix this bug, to the best of my ability. See the
included changelog for details.

I'm not going to be doing an NMU for this, at least not soon, I'd rather
have the maintainer evaluate the patch.

-- 
Never underestimate the power of a small tactical Lisp interpreter.
=== removed file 'Makefile'
--- Makefile    
+++ /dev/null   
@@ -1,2 +0,0 @@
-all:
-       ./configure

=== added file 'Makefile'
--- /dev/null   
+++ Makefile    
@@ -0,0 +1,2 @@
+all:
+       ./configure

=== added file 'debian/postinst'
--- /dev/null   
+++ debian/postinst     
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+if ! id -u Debian-pxe 2>/dev/null >/dev/null
+then
+    adduser --system --no-create-home --disabled-login --force-badname \
+       --gecos "Dummy user for Debian pxe package" Debian-pxe
+fi
+
+#DEBHELPER#

=== added file 'debian/postrm'
--- /dev/null   
+++ debian/postrm       
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+rm -f /var/run/pxe/pxe.pid /var/run/pxe.pid
+if [ -d /var/run/pxe ]; then rmdir /var/run/pxe; fi

=== added file 'debian/prerm'
--- /dev/null   
+++ debian/prerm        
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = failed-upgrade ]
+then
+       # The old version's prerm failed to work. This may be due to
+       # http://bugs.debian.org/376501 so we try to kill the daemon
+       # by hand here.
+       if [ -e /var/run/pxe.pid ]
+       then
+               kill -s KILL $(cat /var/run/pxe.pid) || true
+               rm -f /var/run/pxe.pid
+               exit 0
+       fi
+fi
+
+#DEBHELPER#

=== modified file 'config.guess'
--- config.guess        
+++ config.guess        
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2005-08-03'
+timestamp='2006-02-23'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -106,7 +106,7 @@
 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && 
exit \$exitcode" 0 ;
 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 
;
 : ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n 
"$tmp" && test -d "$tmp" ; } ||
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n 
"$tmp" && test -d "$tmp" ; } ||
  { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) 
; } ||
  { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating 
insecure temp directory" >&2 ; } ||
  { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } 
;
@@ -206,6 +206,9 @@
     *:ekkoBSD:*:*)
        echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
        exit ;;
+    *:SolidBSD:*:*)
+       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+       exit ;;
     macppc:MirBSD:*:*)
        echo powerppc-unknown-mirbsd${UNAME_RELEASE}
        exit ;;
@@ -764,12 +767,20 @@
        echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
        exit ;;
     *:FreeBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 
's/[-(].*//'`
+       case ${UNAME_MACHINE} in
+           pc98)
+               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 
's/[-(].*//'` ;;
+           *)
+               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed 
-e 's/[-(].*//'` ;;
+       esac
        exit ;;
     i*:CYGWIN*:*)
        echo ${UNAME_MACHINE}-pc-cygwin
        exit ;;
     i*:MINGW*:*)
+       echo ${UNAME_MACHINE}-pc-mingw32
+       exit ;;
+    i*:MSYS_NT-*:*:*)
        echo ${UNAME_MACHINE}-pc-mingw32
        exit ;;
     i*:windows32*:*)
@@ -779,8 +790,11 @@
     i*:PW*:*)
        echo ${UNAME_MACHINE}-pc-pw32
        exit ;;
-    x86:Interix*:[34]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
+    x86:Interix*:[345]*)
+       echo i586-pc-interix${UNAME_RELEASE}
+       exit ;;
+    EM64T:Interix*:[345]*)
+       echo x86_64-unknown-interix${UNAME_RELEASE}
        exit ;;
     [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
        echo i${UNAME_MACHINE}-pc-mks
@@ -851,7 +865,11 @@
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
        ;;
     mips64:Linux:*:*)
@@ -870,7 +888,11 @@
        #endif
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^CPU/{
+               s: ::g
+               p
+           }'`"
        test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
        ;;
     or32:Linux:*:*)
@@ -918,6 +940,9 @@
        exit ;;
     sparc:Linux:*:* | sparc64:Linux:*:*)
        echo ${UNAME_MACHINE}-unknown-linux-gnu
+       exit ;;
+    vax:Linux:*:*)
+       echo ${UNAME_MACHINE}-dec-linux-gnu
        exit ;;
     x86_64:Linux:*:*)
        echo x86_64-unknown-linux-gnu
@@ -964,7 +989,7 @@
        LIBC=gnulibc1
        # endif
        #else
-       #ifdef __INTEL_COMPILER
+       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__sun)
        LIBC=gnu
        #else
        LIBC=gnuaout
@@ -974,7 +999,11 @@
        LIBC=dietlibc
        #endif
 EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+           /^LIBC/{
+               s: ::g
+               p
+           }'`"
        test x"${LIBC}" != x && {
                echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
                exit
@@ -1185,7 +1214,6 @@
     *:Darwin:*:*)
        UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
        case $UNAME_PROCESSOR in
-           *86) UNAME_PROCESSOR=i686 ;;
            unknown) UNAME_PROCESSOR=powerpc ;;
        esac
        echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1263,6 +1291,9 @@
        exit ;;
     i*86:skyos:*:*)
        echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ 
.*$//'
+       exit ;;
+    i*86:rdos:*:*)
+       echo ${UNAME_MACHINE}-pc-rdos
        exit ;;
 esac
 

=== modified file 'config.sub'
--- config.sub  
+++ config.sub  
@@ -3,7 +3,7 @@
 #   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
 #   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
-timestamp='2005-07-08'
+timestamp='2006-02-23'
 
 # This file is (in principle) common to ALL GNU software.
 # The presence of a machine in this file suggests that SOME GNU software
@@ -119,8 +119,9 @@
 # Here we must recognize all the valid KERNEL-OS combinations.
 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
 case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | 
uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | 
rtmk-nova*)
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | 
netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
     os=-$maybe_os
     basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
     ;;
@@ -171,6 +172,10 @@
        -hiux*)
                os=-hiuxwe2
                ;;
+       -sco6)
+               os=-sco5v6
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
        -sco5)
                os=-sco3.2v5
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
@@ -184,6 +189,10 @@
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
        -sco3.2v[4-9]*)
+               # Don't forget version if it is 3.2v4 or newer.
+               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+               ;;
+       -sco5v6*)
                # Don't forget version if it is 3.2v4 or newer.
                basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
                ;;
@@ -239,7 +248,7 @@
        | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
        | i370 | i860 | i960 | ia64 \
        | ip2k | iq2000 \
-       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
+       | m32r | m32rle | m68000 | m68k | m88k | maxq | mb | microblaze | mcore 
\
        | mips | mipsbe | mipseb | mipsel | mipsle \
        | mips16 \
        | mips64 | mips64el \
@@ -257,8 +266,9 @@
        | mipsisa64sr71k | mipsisa64sr71kel \
        | mipstx39 | mipstx39el \
        | mn10200 | mn10300 \
-       | ms1 \
+       | mt \
        | msp430 \
+       | nios | nios2 \
        | ns16k | ns32k \
        | or32 \
        | pdp10 | pdp11 | pj | pjl \
@@ -285,6 +295,9 @@
                os=-none
                ;;
        m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+               ;;
+       ms1)
+               basic_machine=mt-unknown
                ;;
 
        # We use `pc' rather than `unknown'
@@ -336,8 +349,9 @@
        | mipsisa64sr71k-* | mipsisa64sr71kel-* \
        | mipstx39-* | mipstx39el-* \
        | mmix-* \
-       | ms1-* \
+       | mt-* \
        | msp430-* \
+       | nios-* | nios2-* \
        | none-* | np1-* | ns16k-* | ns32k-* \
        | orion-* \
        | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
@@ -696,6 +710,9 @@
                basic_machine=i386-pc
                os=-msdos
                ;;
+       ms1-*)
+               basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+               ;;
        mvs)
                basic_machine=i370-ibm
                os=-mvs
@@ -803,6 +820,12 @@
        pc532 | pc532-*)
                basic_machine=ns32k-pc532
                ;;
+       pc98)
+               basic_machine=i386-pc
+               ;;
+       pc98-*)
+               basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+               ;;
        pentium | p5 | k5 | k6 | nexgen | viac3)
                basic_machine=i586-pc
                ;;
@@ -858,6 +881,10 @@
        pw32)
                basic_machine=i586-unknown
                os=-pw32
+               ;;
+       rdos)
+               basic_machine=i386-pc
+               os=-rdos
                ;;
        rom68k)
                basic_machine=m68k-rom68k
@@ -1174,21 +1201,23 @@
              | -aos* \
              | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
              | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* 
\
+             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+             | -openbsd* | -solidbsd* \
              | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
              | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
              | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
              | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
              | -chorusos* | -chorusrdb* \
              | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | 
-mpeix* | -udk* \
+             | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+             | -uxpv* | -beos* | -mpeix* | -udk* \
              | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
              | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
              | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
              | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
              | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
              | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku*)
+             | -skyos* | -haiku* | -rdos*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        -qnx*)

=== modified file 'debian/changelog'
--- debian/changelog    
+++ debian/changelog    
@@ -1,3 +1,27 @@
+pxe (1.4.2-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * debian/postinst: Created. In addition to the usual stuff added by
+    debhelper, we now create a Debian-pxe user.
+  * debian/prerm: Created. Handle a failed upgrade from a previous
+    version by manually killing the daemon and removing the pid file.
+  * debian/postrm: Remove /var/run/pxe, /var/run/pxe/pxe.pid, and
+    /var/run/pxe.pid.
+  * debian/init.d: Create /var/run/pxe before starting the daemon,
+    and chown it to the Debian-pxe user. Also, wait for the pid file
+    to disappear when stopping (or restarting), instead of blindly
+    assuming that one second is enough. Further, allow start-stop-daemon
+    to not do anything (--oknodo) when doing "start", "stop", or the
+    stopping part of "restart".
+  * debian/rules: Tweak (with sed, since ./configure has no option) the
+    LOCKFILE setting in autoconf.h to /var/run/pxe/pxe.pid, instead of
+    the old value of /var/run/pxe.pid.
+  * Closes: #376501.
+  * debian/control: Updates Standards-Version to 3.7.2. No other changes
+    required.
+
+ -- Lars Wirzenius <[EMAIL PROTECTED]>  Sat, 12 Aug 2006 23:25:49 +0300
+
 pxe (1.4.2-3) unstable; urgency=low
 
   * pxe.cc: Added patch to fix segfaulting (Closes: #330851).

=== modified file 'debian/control'
--- debian/control      
+++ debian/control      
@@ -3,12 +3,12 @@
 Priority: optional
 Maintainer: Daniel Baumann <[EMAIL PROTECTED]>
 Build-Depends: debhelper (>= 4.0.0), docbook-to-man
-Standards-Version: 3.6.2
+Standards-Version: 3.7.2
 
 Package: pxe
 Section: net
 Architecture: any
-Depends: ${shlibs:Depends}
+Depends: ${shlibs:Depends}, adduser
 Recommends: dhcp3-server, atftpd, syslinux
 Description: free PX daemon
  PXE is a specification to boot PCs from the net. Apart from BOOTP or DHCP for

=== modified file 'debian/init.d'
--- debian/init.d       
+++ debian/init.d       
@@ -4,6 +4,25 @@
 DAEMON=/usr/sbin/pxe
 NAME=pxe
 DESC=pxe
+PID=/var/run/$NAME/$NAME.pid
+
+create_pid_dir()
+{
+       dir=$(dirname "$PID")
+       if [ ! -d "$dir" ]
+       then
+               mkdir "$dir"
+       fi
+       chown Debian-pxe "$dir"
+}
+
+wait_no_pid()
+{
+       while [ -e "$PID" ]
+       do
+               sleep 1
+       done
+}
 
 test -x $DAEMON || exit 0
 
@@ -12,24 +31,26 @@
 case "$1" in
        start)
                echo -n "Starting $DESC: "
-               start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
-                       --exec $DAEMON
+               create_pid_dir
+               start-stop-daemon --start --quiet --pidfile $PID \
+                       --oknodo --exec $DAEMON
                echo "$NAME."
                ;;
 
        stop)
                echo -n "Stopping $DESC: "
-               start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
-                       --exec $DAEMON
+               start-stop-daemon --stop --quiet --pidfile $PID \
+                       --oknodo --exec $DAEMON
+               wait_no_pid
                echo "$NAME."
                ;;
 
        restart|force-reload)
                echo -n "Restarting $DESC: "
-               start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
-                       --exec $DAEMON
-               sleep 1
-               start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
+               start-stop-daemon --stop --quiet --pidfile $PID \
+                       --oknodo --exec $DAEMON
+               wait_no_pid
+               start-stop-daemon --start --quiet --pidfile $PID \
                        --exec $DAEMON
                echo "$NAME."
                ;;

=== modified file 'debian/rules'
--- debian/rules        
+++ debian/rules        
@@ -20,7 +20,8 @@
        dh_testdir
 
        # Configuring package
-       CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) 
--build=$(DEB_BUILD_GNU_TYPE) --with-log=/var/log/pxe.log
+       CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) 
--build=$(DEB_BUILD_GNU_TYPE) --with-log=/var/log/pxe.log 
--with-setuid=Debian-pxe
+       sed -i 's:^#define LOCKFILE.*:#define LOCKFILE "/var/run/pxe/pxe.pid":' 
autoconf.h
 
 build: build-stamp
 build-stamp:  config.status

Reply via email to