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

Bug#718798: marked as done (cups-daemon: suggestions for init script: bashisms, lsb...)



Your message dated Sat, 04 Jan 2014 15:19:54 +0000
with message-id <E1VzT10-0006ka-0C@franck.debian.org>
and subject line Bug#718798: fixed in cups 1.7.0-2
has caused the Debian Bug report #718798,
regarding cups-daemon: suggestions for init script: bashisms, lsb...
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
718798: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718798
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: cups-daemon
Version: 1.6.2-10
Severity: minor
Tags: patch

Hello. Please consider the attached changes, inspired by
/etc/init.d/skeleton and
http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html.
The skeleton may suggest many other easy improvements in calls to
start-stop-daemon, but I lack knowledge of CUPS to decide such
changes.

Comments, roughly in the order of the attached diff:

SCRIPTNAME replaces N=${0##*/}. This construct is specific to bash,
while init scripts may be executed by sh.

Include /lib/init/vars.sh and respect VERBOSE when appropriate.

Replace restart_xprint() implicit parameter (success) with an explicit
first parameter for readability.

log_daemon_msg() should be used instead of log_begin_msg(). The former
wraps the latter with vendor-specific formatting.

I tryed to clarify the exit status handling. For example: in start),
the displayed $? was the one of coldplug_usb_printers instead of the
one from start-stop-daemon.

coldplug_usb_printer was called even if in case of failure to start
the daemon. I changed this, but maybe this was wanted.

status_of_proc() replaces hand-written status reporting, with a more
accurate selection of non-zero exit statuses. It needs lsb-base (>=
3.2-14).

Unimplemented actions must return 3.
diff --git a/debian/control b/debian/control
index 549219d..f1c333a 100644
--- a/debian/control
+++ b/debian/control
@@ -142,7 +142,7 @@ Depends: ${shlibs:Depends},
  poppler-utils (>= 0.12),
  procps,
  ghostscript (>= 9.02~),
- lsb-base (>= 3),
+ lsb-base (>= 3.2-14),
  cups-common (>= ${source:Version}),
  cups-server-common (>= ${source:Version}),
  cups-client (>= ${binary:Version}),
diff --git a/debian/cups-daemon.cups.init b/debian/cups-daemon.cups.init
index 06a6d8f..de25cee 100644
--- a/debian/cups-daemon.cups.init
+++ b/debian/cups-daemon.cups.init
@@ -14,22 +14,33 @@
 #                    make it's web interface accessible on http://localhost:631/
 ### END INIT INFO
 
+# Author: Debian Printing Team <debian-printing@lists.debian.org>
+
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
 DAEMON=/usr/sbin/cupsd
 NAME=cupsd
 PIDFILE=/var/run/cups/$NAME.pid
 DESC="Common Unix Printing System"
+SCRIPTNAME=/etc/init.d/cups
 
 unset TMPDIR
 
+# Exit if the package is not installed
 test -x $DAEMON || exit 0
 
 mkdir -p /var/run/cups/certs
 
+# Read configuration variable file if it is present
 if [ -r /etc/default/cups ]; then
   . /etc/default/cups
 fi
 
+# Load the VERBOSE setting and other rcS variables
+. /lib/init/vars.sh
+
+# Define LSB log_* functions.
+# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
+# and status_of_proc is working.
 . /lib/lsb/init-functions
 
 # Get the timezone set.
@@ -38,8 +49,9 @@ if [ -z "$TZ" -a -e /etc/timezone ]; then
     export TZ
 fi
 
+# Only effective if first parameter = 0.
 restart_xprint() {
-    if [ -n "$success" ] && [ -x /etc/init.d/xprint ]; then
+    if [ "$1" = 0 ] && [ -x /etc/init.d/xprint ]; then
         invoke-rc.d xprint force-reload || true
     fi
 }
@@ -57,7 +69,7 @@ coldplug_usb_printers() {
 
 case "$1" in
   start)
-	log_begin_msg "Starting $DESC: $NAME"
+	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
 
 	mkdir -p `dirname "$PIDFILE"`
 	if [ "$LOAD_LP_MODULE" = "yes" -a -f /usr/lib/cups/backend/parallel \
@@ -67,50 +79,41 @@ case "$1" in
 	  modprobe -q -b parport_pc || true
 	fi
 
-	start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" --exec $DAEMON && success=1
-
-	coldplug_usb_printers
-	log_end_msg $?
-	restart_xprint
+	start-stop-daemon --start --quiet --oknodo --pidfile "$PIDFILE" --exec $DAEMON
+	status=$?
+	[ $status = 0 ] && coldplug_usb_printers
+	[ "$VERBOSE" != no ] && log_end_msg $status
+	restart_xprint $status
 	;;
   stop)
-	log_begin_msg "Stopping $DESC: $NAME"
-	start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME && success=1
-	log_end_msg $?
-	restart_xprint
+	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
+	start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME
+	status=$?
+	[ "$VERBOSE" != no ] && log_end_msg $status
+	restart_xprint $status
 	;;
   reload|force-reload)
-       log_begin_msg "Reloading $DESC: $NAME"
-       start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --signal 1 && success=1
-       log_end_msg $?
-	restart_xprint
+       log_daemon_msg "Reloading $DESC" "$NAME"
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE --name $NAME --signal 1
+       status=$?
+       log_end_msg $status
+       restart_xprint $status
        ;;
   restart)
-	log_begin_msg "Restarting $DESC: $NAME"
+	log_daemon_msg "Restarting $DESC" "$NAME"
 	if start-stop-daemon --stop --quiet --retry 5 --oknodo --pidfile $PIDFILE --name $NAME; then
-		start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON && success=1
+		start-stop-daemon --start --quiet --pidfile "$PIDFILE" --exec $DAEMON
 	fi
-	log_end_msg $?
-	restart_xprint
+	status=$?
+	log_end_msg $status
+	restart_xprint $status
 	;;
   status)
-	echo -n "Status of $DESC: "
-	if [ ! -r "$PIDFILE" ]; then
-		echo "$NAME is not running."
-		exit 3
-	fi
-	if read pid < "$PIDFILE" && ps -p "$pid" > /dev/null 2>&1; then
-		echo "$NAME is running."
-		exit 0
-	else
-		echo "$NAME is not running but $PIDFILE exists."
-		exit 1
-	fi
+	status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
 	;;
   *)
-	N=/etc/init.d/${0##*/}
-	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
-	exit 1
+	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+	exit 3
 	;;
 esac
 

--- End Message ---
--- Begin Message ---
Source: cups
Source-Version: 1.7.0-2

We believe that the bug you reported is fixed in the latest version of
cups, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 718798@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Didier Raboud <odyx@debian.org> (supplier of updated cups package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Format: 1.8
Date: Sat, 04 Jan 2014 15:46:02 +0100
Source: cups
Binary: libcups2 libcupsimage2 libcupscgi1 libcupsmime1 libcupsppdc1 cups cups-daemon cups-client libcups2-dev libcupsimage2-dev libcupscgi1-dev libcupsmime1-dev libcupsppdc1-dev cups-bsd cups-common cups-server-common cups-ppdc cups-dbg
Architecture: source amd64 all
Version: 1.7.0-2
Distribution: unstable
Urgency: low
Maintainer: Debian Printing Team <debian-printing@lists.debian.org>
Changed-By: Didier Raboud <odyx@debian.org>
Description: 
 cups       - Common UNIX Printing System(tm) - server
 cups-bsd   - Common UNIX Printing System(tm) - BSD commands
 cups-client - Common UNIX Printing System(tm) - client programs (SysV)
 cups-common - Common UNIX Printing System(tm) - common files
 cups-daemon - Common UNIX Printing System(tm) - daemon
 cups-dbg   - Common UNIX Printing System(tm) - debugging symbols
 cups-ppdc  - Common UNIX Printing System(tm) - PPD manipulation utilities
 cups-server-common - Common UNIX Printing System(tm) - server common files
 libcups2   - Common UNIX Printing System(tm) - Core library
 libcups2-dev - Common UNIX Printing System(tm) - Development files CUPS library
 libcupscgi1 - Common UNIX Printing System(tm) - CGI library
 libcupscgi1-dev - Common UNIX Printing System(tm) - Development files for CGI libra
 libcupsimage2 - Common UNIX Printing System(tm) - Raster image library
 libcupsimage2-dev - Common UNIX Printing System(tm) - Development files CUPS image li
 libcupsmime1 - Common UNIX Printing System(tm) - MIME library
 libcupsmime1-dev - Common UNIX Printing System(tm) - Development files MIME library
 libcupsppdc1 - Common UNIX Printing System(tm) - PPD manipulation library
 libcupsppdc1-dev - Common UNIX Printing System(tm) - Development files PPD library
Closes: 570157 677580 718798
Changes: 
 cups (1.7.0-2) unstable; urgency=low
 .
   [ Russell Coker ]
   * In the cups init script, run restorecon after creating a /var/run
     directory (Closes: #677580)
 .
   [ Bastien ROUCARIÈS ]
   * Add patch to drop two dangling references in cups-lpd.man
     (Closes: #570157)
 .
   [ Nicolas Boulenguez ]
   * Enhance cups' init-script(Closes: #718798)
     - Specify SCRIPTNAME instead of relying on N=${0##*/} bashism
     - Replace restart_xprint() implicit parameter (success) with an
       explicit first parameter for readability
     - Replace log_begin_msg() calls by log_daemon_msg() to use the
       vendor-specific formatting
     - Clarify exit statuses handling by making sure only the result of
       start-stop-daemon is returned
     - Don't call coldplug_usb_printers when the daemon fails to start
     - Use status_of_proc from lsb-base >= 3.2.14 instead of a
       hand-written implementation
     - Unimplemented actions must return 3
 .
   [ Didier Raboud ]
   * Let uscan verify PGP signatures on signed upstream tarballs
   * Update manpage-hyphen-minus.patch to fix three missing fixes in
     ippfind.1
   * Add patch to fix expres{,s}ion typo
   * Fix two occurences of pointer-from-integer in the color-management
     extension patch
   * Update drop_unnecessary_dependencies patch to make sure
     libcupsimage2 is linked against pthread
   * Bump Standards-Version to 3.9.5 without changes needed
Checksums-Sha1: 
 5456f30a0b2bdfdff3e61920f748b9b80806a608 3188 cups_1.7.0-2.dsc
 be18729e171d3e8dc99cf8c96126ee714190ed8f 441178 cups_1.7.0-2.debian.tar.gz
 dff9f5df379c13ee049f2738a1c928f4e9a5263a 269098 libcups2_1.7.0-2_amd64.deb
 a1479b2bfc84d412f6f28158bf1e6e0387f5deb0 106864 libcupsimage2_1.7.0-2_amd64.deb
 4fd91f580b8339711d0b2849a3fc87a7d3b771e5 117750 libcupscgi1_1.7.0-2_amd64.deb
 1fefd9b36bd5182243e22e1c6da0dbb7d10de656 103738 libcupsmime1_1.7.0-2_amd64.deb
 1b484a55d18b165f7c84af653bcc71021cf950e0 135814 libcupsppdc1_1.7.0-2_amd64.deb
 8efbfb1ff9c9906fbd5a92889f02fd9fdf5491b4 294652 cups_1.7.0-2_amd64.deb
 de15e67a0d82a3fb6d3b3d02f0ae48cdd5ff6d45 354492 cups-daemon_1.7.0-2_amd64.deb
 8d73caeccd5af652241cb4fef066877cc36fa805 286708 cups-client_1.7.0-2_amd64.deb
 3b433029b2ea2d8ad1e789fd3b29c78ec7a573c8 307212 libcups2-dev_1.7.0-2_amd64.deb
 26fc206b088d8d92f9f26fb5e17c04896b4e10db 18112 libcupsimage2-dev_1.7.0-2_amd64.deb
 cdc507e50c822592c36d05839003b796df307027 120224 libcupscgi1-dev_1.7.0-2_amd64.deb
 ee70e7ff65a3c0ee879700fd9863c1ae18930a1d 104380 libcupsmime1-dev_1.7.0-2_amd64.deb
 573d3a5e3f3900903745866c97125ff6a71889ea 140888 libcupsppdc1-dev_1.7.0-2_amd64.deb
 dd5d76c05deee0b3dc2641124d6eb09529178596 26562 cups-bsd_1.7.0-2_amd64.deb
 99e3904545fcda7fac5391a63a84e70ab6aaed5c 235436 cups-common_1.7.0-2_all.deb
 79039d968e273782b8c6df4ea640a69d93039d7e 589902 cups-server-common_1.7.0-2_all.deb
 f62d2135a58a2a86dbee4f59d0344f5bd13c7961 117016 cups-ppdc_1.7.0-2_amd64.deb
 a0fffe2a8ecc836dae3a39d3e484cf729266bd6e 2123558 cups-dbg_1.7.0-2_amd64.deb
Checksums-Sha256: 
 e050ecfd82e6805b4a4857bd682550305baee2804d912e51eef78d118d1ad439 3188 cups_1.7.0-2.dsc
 b908a493c502a2ceabf471a2b1d4007f02ce947c58b55547c6cd13db72e8ce1f 441178 cups_1.7.0-2.debian.tar.gz
 761ff4e38561ae0b2eeb0fc0f9cd2b1cea188573e22f840e785e0611db0db37e 269098 libcups2_1.7.0-2_amd64.deb
 2ba1005c1d0cd8094f621bb11d4f90bd826be0e41f5fb04f535c19eb8b9cca20 106864 libcupsimage2_1.7.0-2_amd64.deb
 927f1f1b61ca6b5814250c5cbbb27173a47f9152b98baa08249e07f9c06fe607 117750 libcupscgi1_1.7.0-2_amd64.deb
 c47fe95fa154149f0f47c281a605f62f88e868bf73f5b3e61a7eb4195c26f8c4 103738 libcupsmime1_1.7.0-2_amd64.deb
 458a8fd64703c28e683911f73c7b41d5dfbc2ad370e0888485beead34b02e0c1 135814 libcupsppdc1_1.7.0-2_amd64.deb
 c95c1b0a1a50f612bc2e7b20ca4d4c766d5c057bddd8d0ba3c5c2082807a2e04 294652 cups_1.7.0-2_amd64.deb
 dab8f230eb098333d2e20ee7093aa3ea9ca3429e79b14b6733a502993f6ef88c 354492 cups-daemon_1.7.0-2_amd64.deb
 f67c94e65e883b1f3087ef2697b6bb7a80530d737c8b63e166a498b631974af9 286708 cups-client_1.7.0-2_amd64.deb
 917dd217a00ecc54b96abd9accfe99a63ef6c5ae6fa7865e1a699821420c94a4 307212 libcups2-dev_1.7.0-2_amd64.deb
 775c0481708ba678001b07411e7b007ab9fcbc0714572532d007cffca9429845 18112 libcupsimage2-dev_1.7.0-2_amd64.deb
 755261ec8790dfe8a35f9eb7e33ca38e8619316dc43c7a664a67a1b26c266119 120224 libcupscgi1-dev_1.7.0-2_amd64.deb
 a3e7df316cd9f164def320b41cfa5b18ef258727659966e3ccc33634fe053daf 104380 libcupsmime1-dev_1.7.0-2_amd64.deb
 899b7cbbff6f622229daa016d76e4d7fb7e52dce5e322f7b772ca2b36b41c5f3 140888 libcupsppdc1-dev_1.7.0-2_amd64.deb
 e6377f614eb734aa5a9c199a0d2ca122731816fc3a1424ae4e891a6c2810523f 26562 cups-bsd_1.7.0-2_amd64.deb
 d439373bf70d993050c0932c6fd0af93434234944dd6d1dcc2f346600d132ff7 235436 cups-common_1.7.0-2_all.deb
 1bbcba66ee3a4c89db2e79761051a89eba27a872658277148c68d57bbf498fb7 589902 cups-server-common_1.7.0-2_all.deb
 a2aba825bbe2eb3d46f432b0b961b181aef9b347c8443dffb2294f4c6d57f119 117016 cups-ppdc_1.7.0-2_amd64.deb
 ab83291b7e74c2b12093bfdc3a2ae584147f9c0b140b438240fe88f638d06d33 2123558 cups-dbg_1.7.0-2_amd64.deb
Files: 
 ef2b504613bd520b50b709117aaf96a2 3188 net optional cups_1.7.0-2.dsc
 1fa1b53661d459f0f1e01f91e69469c0 441178 net optional cups_1.7.0-2.debian.tar.gz
 e267886153f1dbf49c75efde186d6852 269098 libs optional libcups2_1.7.0-2_amd64.deb
 8ff703476e349f357d9b1940d8a3ad9c 106864 libs optional libcupsimage2_1.7.0-2_amd64.deb
 bf8528ba7e1c28a95327b0ea584e26c2 117750 libs optional libcupscgi1_1.7.0-2_amd64.deb
 df22274fe4cc4054679b7b8e1a496a5c 103738 libs optional libcupsmime1_1.7.0-2_amd64.deb
 eb8400125a6d7571b45ec48ca4eb6e17 135814 libs optional libcupsppdc1_1.7.0-2_amd64.deb
 81373725e5f006615a79bca47736be40 294652 net optional cups_1.7.0-2_amd64.deb
 bb5909c8ac04e3aefbd11a71a6e0e9b6 354492 net optional cups-daemon_1.7.0-2_amd64.deb
 f4361965741cf4c51c77b8829854f2c4 286708 net optional cups-client_1.7.0-2_amd64.deb
 b9adbbcaf45e4be5a4d1ff31abd65d25 307212 libdevel optional libcups2-dev_1.7.0-2_amd64.deb
 d172b15b298d2a78f3dc9ff90afd7995 18112 libdevel optional libcupsimage2-dev_1.7.0-2_amd64.deb
 4df5b834aa2bb3e91d127e5597d62fbf 120224 libdevel optional libcupscgi1-dev_1.7.0-2_amd64.deb
 c55bc5b63b3dcf244a2d4f5d6ec26696 104380 libdevel optional libcupsmime1-dev_1.7.0-2_amd64.deb
 4aa8b8702db716080d0ce5c4d6625d5c 140888 libdevel optional libcupsppdc1-dev_1.7.0-2_amd64.deb
 925379a3e0d58cfe0fd81f95d2978a10 26562 net extra cups-bsd_1.7.0-2_amd64.deb
 8c33eaf6b843189eb25387c2a4d7af9e 235436 net optional cups-common_1.7.0-2_all.deb
 5ce38ee99c0ba3c31eecf325fa75a372 589902 net optional cups-server-common_1.7.0-2_all.deb
 fa444e205424fa8fbf3a39da6448ae5b 117016 utils optional cups-ppdc_1.7.0-2_amd64.deb
 fecf0d5b83077e7ddd13f5f646547ffb 2123558 debug extra cups-dbg_1.7.0-2_amd64.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)

iQGcBAEBCAAGBQJSyCPEAAoJEIvPpx7KFjRVOCkL/2TwozgInPJRSYTIPVFgTEyn
vVgoYsn4D/qzRE7/gNXxWu7fHJM76ZpTwfTvZYiz2NJi6XJc3wseJAifcMPExjqd
5Ny/IyZBC0ty+Zd/L3DfvN6avlPXAZ2wX0mi7INH24dyLKW8+Tmedd0GcUFKBQAc
Ra78oSnFoyIR+j45538CLwAMq1li2V80c0ZITCLfofGFEnzS1hhzKgsFaLrE3+7Y
VHRRSy/tToBJAKi86Gg36kTgZw7rwUPeHcv7ReVZeoBs93HIyhxipGp8m1yiEYv+
rP5CAa/cIbM+fXTVc5E+nyN8R5w/dQtLq9ohSVSyNvi5HenO/2enP6QNl/UT9laN
kZD6YiX6LXzAJmmeezBs7kUXjwRB5Gb/vo6VP40FX5IQkAPuzEvXMqmi/W7HQ9UB
+05p7s4arwwfNJI+KTETEhMmoUkeKDeBrpF6AJQe5WGEo5qi03EKlbjWzML/Wr4f
jVlhPntqhlAWh+WnK06NmBrFaEWSawz8yiJN7E3+xA==
=52Yr
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: