Bug#617644: pdnsd: fails to start, broken init script
tag 617644 patch thanks 2011/3/10 RjY : > Package: pdnsd > Version: 1.2.8-par-1 > Severity: grave > Justification: renders package unusable > > /etc/init.d/pdnsd has several problems that prevent pdnsd from starting. > > Firstly line 28 > > test -f . /etc/default/rcS || exit 0 > > This just produces an error, '.: unexpected operator' > > (I just deleted the line. I don't think /etc/default/rcS is needed at > all, there doesn't appear to be any variable from it referenced, but I > might have missed something.) > > > > Secondly, line ~20 > > test -f /etc/default/$NAME > > /etc/default/pdnsd is tested for, but never actually sourced. So > START_DAEMON is never set to 'yes' so the script thinks the daemon is > disabled, and never runs it. > > > > Fixing these two at least allows the daemon to start. I also noticed > that $AUTO_MODE handling is apparently broken (although I don't use one) > > if test -z "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf > > I think the first test should be -n. -z means "is a zero-length string", > -n means "is _not_ a zero-length string". > Hello, Seems like i missing configurations during last upload. i got no problem. i'll fixing neext upload > pdnsd suggests no packages. > > -- Configuration Files: > /etc/default/pdnsd changed: > START_DAEMON=yes > AUTO_MODE= > START_OPTIONS= > > /etc/init.d/pdnsd changed: > NAME="pdnsd" > DESC="proxy DNS server" > DAEMON="/usr/sbin/pdnsd" > PIDFILE="/var/run/pdnsd.pid" > CACHE="/var/cache/pdnsd/pdnsd.cache" > test -x $DAEMON || exit 0 > test -f "/etc/default/$NAME" || exit 0 > . /etc/default/$NAME > if test -n "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf > then > START_OPTIONS="${START_OPTIONS} -c /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf" > fi > . /lib/lsb/init-functions > is_yes() { > case "$1" in > [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;; > *) return 1; > esac > } > log_end_msg2 () { > log_end_msg "$@" > test $1 -eq 0 || exit 1 > } > gen_cache() > { > if ! test -f "$CACHE"; then > mkdir -p `dirname $CACHE` > dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null > chown -R pdnsd.proxy /var/cache/pdnsd > fi > } > check_pid() > { > if test -f "$PIDFILE"; then > log_warning_msg "pid file is exist in $PIDFILE, stop $pdnsd it > or restart $pdnsd" > exit 1 > fi > } > start_resolvconf() > { > test -x /sbin/resolvconf || return > for f in `seq 1 60`; do > sleep 0.1 > if pdnsd-ctl status >/dev/null 2>&1; then > break > fi > done > if pdnsd-ctl status | grep -q resolvconf; then > server=$(pdnsd-ctl status|sed -ne '/^Global:$/,/^Server.*:$/s/.*Server > ip.*: \(.*\)$/\1/p') > case "$server" in > "") ;; > 0.0.0.0) echo "nameserver 127.0.0.1" | /sbin/resolvconf -a > "lo.$NAME";; > *) echo "nameserver $server" | /sbin/resolvconf -a > "lo.$NAME";; > esac > fi > } > stop_resolvconf() > { > if [ -x /sbin/resolvconf ] ; then > /sbin/resolvconf -d "lo.$NAME" > fi > } > pdnsd_start() > { > if is_yes "$START_DAEMON"; then > check_pid > log_begin_msg "Starting $NAME" > start-stop-daemon --oknodo --start --quiet --pidfile "$PIDFILE" \ > --exec "$DAEMON" -- --daemon -p "$PIDFILE" $START_OPTIONS > log_end_msg2 $? > start_resolvconf > else > log_warning_msg "Not starting $NAME (disabled in /etc/default/$NAME)" > fi > } > pdnsd_stop() > { > log_begin_msg "Stopping $NAME" > start-stop-daemon --oknodo --stop --quiet --user pdnsd > --retry=TERM/3/KILL/3 --pidfile "$PIDFILE" --name "$NAME" > start-stop-daemon --oknodo --stop --quiet --user pdnsd --retry=0/3/KILL/3 > --exec "$DAEMON" > /dev/null > log_end_msg2 $? > rm -f "$PIDFILE" > stop_resolvconf > } > pdnsd_status() > { > if status_of_proc $DAEMON $NAME; then > /usr/sbin/pdnsd-ctl status > fi > } > case "$1" in > start) > gen_cache > pdnsd_start > ;; > stop) > pdnsd_stop > ;; > status) > pdnsd_status > ;; > restart|force-reload) > pdnsd_stop > pdnsd_start > ;; > *) > echo "Usage: /etc/init.d/$NAME > {start|stop|restart|force-reload|status}" >&2 > exit 1 > ;; > esac > exit 0 > > /etc/pdnsd.conf changed: > // Read the pdnsd.conf(5) manpage for an explanation of the options. > /* Note: this file is overriden by automatic config files when > /etc/default/pdnsd AUTO_MODE is set and that > /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf exists > */ > // 2010-08-15: comment out server_ip to listen on all interface, > // uncomment root-servers section to do recursive resolving > global { > perm_cache=1024; > cache_dir="/var/cache/pdnsd"; > run_as="pdnsd"; > // server_ip = 127.0.0.1; // Use eth0 here if you want to allow other > //
Bug#617644: pdnsd: fails to start, broken init script
Package: pdnsd Version: 1.2.8-par-1 Severity: grave Justification: renders package unusable /etc/init.d/pdnsd has several problems that prevent pdnsd from starting. Firstly line 28 test -f . /etc/default/rcS || exit 0 This just produces an error, '.: unexpected operator' (I just deleted the line. I don't think /etc/default/rcS is needed at all, there doesn't appear to be any variable from it referenced, but I might have missed something.) Secondly, line ~20 test -f /etc/default/$NAME /etc/default/pdnsd is tested for, but never actually sourced. So START_DAEMON is never set to 'yes' so the script thinks the daemon is disabled, and never runs it. Fixing these two at least allows the daemon to start. I also noticed that $AUTO_MODE handling is apparently broken (although I don't use one) if test -z "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf I think the first test should be -n. -z means "is a zero-length string", -n means "is _not_ a zero-length string". -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.37-2-686 (SMP w/1 CPU core) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages pdnsd depends on: ii adduser 3.112+nmu2 add and remove users and groups ii debconf [debconf-2.0] 1.5.38 Debian configuration management sy ii libc6 2.11.2-11 Embedded GNU C Library: Shared lib Versions of packages pdnsd recommends: pn resolvconf (no description available) pdnsd suggests no packages. -- Configuration Files: /etc/default/pdnsd changed: START_DAEMON=yes AUTO_MODE= START_OPTIONS= /etc/init.d/pdnsd changed: NAME="pdnsd" DESC="proxy DNS server" DAEMON="/usr/sbin/pdnsd" PIDFILE="/var/run/pdnsd.pid" CACHE="/var/cache/pdnsd/pdnsd.cache" test -x $DAEMON || exit 0 test -f "/etc/default/$NAME" || exit 0 . /etc/default/$NAME if test -n "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf then START_OPTIONS="${START_OPTIONS} -c /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf" fi . /lib/lsb/init-functions is_yes() { case "$1" in [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|1) return 0;; *) return 1; esac } log_end_msg2 () { log_end_msg "$@" test $1 -eq 0 || exit 1 } gen_cache() { if ! test -f "$CACHE"; then mkdir -p `dirname $CACHE` dd if=/dev/zero of="$CACHE" bs=1 count=4 2> /dev/null chown -R pdnsd.proxy /var/cache/pdnsd fi } check_pid() { if test -f "$PIDFILE"; then log_warning_msg "pid file is exist in $PIDFILE, stop $pdnsd it or restart $pdnsd" exit 1 fi } start_resolvconf() { test -x /sbin/resolvconf || return for f in `seq 1 60`; do sleep 0.1 if pdnsd-ctl status >/dev/null 2>&1; then break fi done if pdnsd-ctl status | grep -q resolvconf; then server=$(pdnsd-ctl status|sed -ne '/^Global:$/,/^Server.*:$/s/.*Server ip.*: \(.*\)$/\1/p') case "$server" in "") ;; 0.0.0.0) echo "nameserver 127.0.0.1" | /sbin/resolvconf -a "lo.$NAME";; *) echo "nameserver $server" | /sbin/resolvconf -a "lo.$NAME";; esac fi } stop_resolvconf() { if [ -x /sbin/resolvconf ] ; then /sbin/resolvconf -d "lo.$NAME" fi } pdnsd_start() { if is_yes "$START_DAEMON"; then check_pid log_begin_msg "Starting $NAME" start-stop-daemon --oknodo --start --quiet --pidfile "$PIDFILE" \ --exec "$DAEMON" -- --daemon -p "$PIDFILE" $START_OPTIONS log_end_msg2 $? start_resolvconf else log_warning_msg "Not starting $NAME (disabled in /etc/default/$NAME)" fi } pdnsd_stop() { log_begin_msg "Stopping $NAME" start-stop-daemon --oknodo --stop --quiet --user pdnsd --retry=TERM/3/KILL/3 --pidfile "$PIDFILE" --name "$NAME" start-stop-daemon --oknodo --stop --quiet --user pdnsd --retry=0/3/KILL/3 --exec "$DAEMON" > /dev/null log_end_msg2 $? rm -f "$PIDFILE" stop_resolvconf } pdnsd_status() { if status_of_proc $DAEMON $NAME; then /usr/sbin/pdnsd-ctl status fi } case "$1" in start) gen_cache pdnsd_start ;; stop) pdnsd_stop ;; status) pdnsd_status ;; restart|force-reload) pdnsd_stop pdnsd_start ;; *) echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload|status}" >&2 exit 1 ;; esac exit 0 /etc/pdnsd.conf changed: // Read the pdnsd.conf(5) manpage for an explanation of the options. /* Note: this file is overriden by automatic config files when /etc/default/pdnsd AUTO_MODE is set and that /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf exists */ // 2010-08-15: comment out server_ip to listen on all int