[Pkg-sysvinit-devel] Bug#538334: initscripts: /etc/init.d/bootlogd oddities

Cristian Ionescu-Idbohrn cristian.ionescu-idbohrn at axis.com
Fri Jul 24 21:34:10 UTC 2009


Package: initscripts
Version: 2.86.ds1-66
Severity: normal

Let me question some stuff:

--- /etc/init.d/bootlogd.dpkg-dist	2009-07-15 00:40:37.000000000 +0200
+++ /etc/init.d/bootlogd	2009-06-30 18:52:53.000000000 +0200
@@ -12,12 +11,12 @@
 ### END INIT INFO

 PATH=/sbin:/bin  # No remote fs at start

What's the point with setting up a NAME variable (too late) and not
using it either?

-DAEMON=/sbin/bootlogd
-[ -x "$DAEMON" ] || exit 0
 NAME=bootlogd
 DESC="boot logger"
+DAEMON=/sbin/$NAME
+[ -x "$DAEMON" ] || exit 0
 BOOTLOGD_OPTS="-r -c"
-[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
+[ -r /etc/default/$NAME ] && . /etc/default/$NAME
 . /lib/init/vars.sh

 . /lib/lsb/init-functions
@@ -39,13 +38,13 @@
 ACTION="$1"
 case "$0" in
   *stop-bootlog*)

The difference here is that:

-	[ "$ACTION" = start ] && ACTION=stop

$? here will be -ne 0 here if "$ACTION" != start

+	[ "$ACTION" != start ] || ACTION=stop

but -eq 0 here if you invert logic.  The interesting thing is _not_ the
condition exit status.

 	;;
 esac

 case "$ACTION" in
   start)

Whitespace damage here?

-  	# PATH is set above
+	# PATH is set above
 	log_daemon_msg "Starting $DESC" "$NAME"
 	if [ -d /proc/1/. ]
 	then
@@ -70,19 +69,19 @@
 	then
 		[ "$VERBOSE" = no ] || log_action_begin_msg "Moving boot log file"
 		# bootlogd writes to boot, making backup at boot~

Similar with above.  Inverting logic will keep you on the right path.

-		cd /var/log && {
+		! cd /var/log || {
 			chgrp adm boot || :

Continuation '\' is useless if:

-			savelog -q -p -c 5 boot \
-			&& mv boot.0 boot \
-			&& mv boot~ boot.0
+			savelog -q -p -c 5 boot &&
+			mv boot.0 boot &&
+			mv boot~ boot.0
 		}
 		ES=$?
 		[ "$VERBOSE" = no ] || log_action_end_msg $ES
 	fi
 	;;
   restart|force-reload)

What's the point with repeating ourselfs?

- 	/etc/init.d/bootlogd stop
- 	/etc/init.d/bootlogd start
+	$0 stop
+	$0 start
 	;;
   status)
 	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.30-1-686 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  debianutils                 3.2          Miscellaneous utilities specific t
ii  libc6                       2.9-21       GNU C Library: Shared libraries
ii  lsb-base                    3.2-23       Linux Standard Base 3.2 init scrip
ii  mount                       2.15.1~rc1-1 Tools for mounting and manipulatin
ii  sysvinit-utils              2.86.ds1-66  System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.8-2   ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.7-1     utilities that use the proc file s

initscripts suggests no packages.

-- no debconf information


Cheers,

-- 
Cristian





More information about the Pkg-sysvinit-devel mailing list