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

Bug#623377: rpcbind: Please include upstart support in the rpcbind package



tags 719357 patch
tags 623377 patch
thanks

With Luk's approval, I've prepared an NMU to address these two bugs in
rpcbind.  Please find the NMU diff attached.

This NMU will be uploaded to unstable shortly.

-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slangasek@ubuntu.com                                     vorlon@debian.org
=== modified file 'debian/changelog'
--- a/debian/changelog	2012-06-16 00:02:37 +0000
+++ b/debian/changelog	2013-08-12 16:13:00 +0000
@@ -1,3 +1,17 @@
+rpcbind (0.2.0-8.1) unstable; urgency=low
+
+   * Non-maintainer upload, approved by Luk Claes.
+   * Convert rpcbind to Upstart.  Closes: #719357.
+   * Fix to look directly in /run instead of via the /var/run symlink.
+   * Adjust init script to start rpcbind only in rcS, not to try to start it
+     again in runlevels [2345]: the service should always start reliably in
+     rcS, with no reason to ever restart it later.  In practice, insserv
+     already ignores the request to run the script twice (considering it
+     "done" already after leaving runlevel S), so this is merely correcting
+     the documentation of the current behavior.  Closes: #623377.
+
+ -- Steve Langasek <vorlon@debian.org>  Mon, 12 Aug 2013 18:11:48 +0200
+
 rpcbind (0.2.0-8) unstable; urgency=low
 
   * Relabel the files if SE Linux is active

=== modified file 'debian/control'
--- a/debian/control	2012-06-16 00:02:37 +0000
+++ b/debian/control	2013-08-11 10:41:15 +0000
@@ -9,7 +9,7 @@
 
 Package: rpcbind
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 3.2-14), insserv (>= 1.14.0-2.1) | file-rc, initscripts (>= 2.88dsf-13.3)
+Depends: ${shlibs:Depends}, ${misc:Depends}, lsb-base (>= 4.1+Debian3), insserv (>= 1.14.0-2.1) | file-rc, initscripts (>= 2.88dsf-13.3)
 Conflicts: portmap
 Provides: portmap
 Description: converts RPC program numbers into universal addresses

=== modified file 'debian/init.d'
--- a/debian/init.d	2012-06-16 00:02:37 +0000
+++ b/debian/init.d	2013-08-12 16:08:42 +0000
@@ -6,7 +6,7 @@
 # Provides:          rpcbind
 # Required-Start:    $network $local_fs
 # Required-Stop:     $network $local_fs
-# Default-Start:     S 2 3 4 5
+# Default-Start:     S
 # Default-Stop:      0 1 6
 # Short-Description: RPC portmapper replacement
 # Description:       rpcbind is a server that converts RPC (Remote
@@ -78,12 +78,21 @@
 
 case "$1" in
     start)
+        if init_is_upstart; then
+            exit 1
+        fi
         start $OPTIONS
         ;;
     stop)
+        if init_is_upstart; then
+            exit 0
+        fi
         stop
         ;;
     restart|force-reload)
+        if init_is_upstart; then
+            exit 1
+        fi
         stop
         start $OPTIONS
         ;;

=== added file 'debian/patches/run-migration'
--- a/debian/patches/run-migration	1970-01-01 00:00:00 +0000
+++ b/debian/patches/run-migration	2013-08-10 21:22:57 +0000
@@ -0,0 +1,44 @@
+Author: Steve Langasek <steve.langasek@canonical.com>
+Description: Fix to look directly in /run instead of via the /var/run symlink
+ Because /var may be a separate partition, and could even be mounted via NFS,
+ and in wheezy and later /var/run is a symlink to /run, look up our files in
+ /run directly.  This ensures rpcbind can be started early in boot without
+ any races.
+Index: oneiric/src/rpcbind.c
+===================================================================
+--- oneiric.orig/src/rpcbind.c
++++ oneiric/src/rpcbind.c
+@@ -89,7 +89,14 @@
+ /* who to suid to if -s is given */
+ #define RUN_AS  "daemon"
+ 
+-#define RPCBINDDLOCK "/var/run/rpcbind.lock"
++#define RPCBINDDLOCK "/run/rpcbind.lock"
++
++/* Bypass the libtirpc definition, because we know that /var/run is a compat
++ * symlink to /run. */
++#ifdef _PATH_RPCBINDSOCK
++#undef _PATH_RPCBINDSOCK
++#endif
++#define _PATH_RPCBINDSOCK "/run/rpcbind.sock"
+ 
+ int runasdaemon = 0;
+ int insecure = 0;
+Index: oneiric/src/rpcinfo.c
+===================================================================
+--- oneiric.orig/src/rpcinfo.c
++++ oneiric/src/rpcinfo.c
+@@ -75,6 +75,13 @@
+ #define	MAX_VERS	((u_long)4294967295UL)
+ #define	UNKNOWN		"unknown"
+ 
++/* Bypass the libtirpc definition, because we know that /var/run is a compat
++ * symlink to /run. */
++#ifdef _PATH_RPCBINDSOCK
++#undef _PATH_RPCBINDSOCK
++#endif
++#define _PATH_RPCBINDSOCK "/run/rpcbind.sock"
++
+ /*
+  * Functions to be performed.
+  */

=== modified file 'debian/patches/series'
--- a/debian/patches/series	2011-12-10 11:36:35 +0000
+++ b/debian/patches/series	2013-08-10 21:18:15 +0000
@@ -2,3 +2,4 @@
 02-manpages.patch
 03-563971-warmstart-error-msg.patch
 04-610718-non-linux.patch
+run-migration

=== modified file 'debian/postinst'
--- a/debian/postinst	2011-12-10 11:36:35 +0000
+++ b/debian/postinst	2013-08-12 22:46:00 +0000
@@ -10,6 +10,9 @@
 			ln -s /run/rpcbind.pid /run/sendsigs.omit.d/rpcbind
 		fi
 	fi
+	if dpkg --compare-versions "$2" lt "0.2.0-8.1"; then
+		update-rc.d -f rpcbind remove
+	fi
 fi
 
 #DEBHELPER#

=== added file 'debian/rpcbind.portmap-wait.upstart'
--- a/debian/rpcbind.portmap-wait.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/rpcbind.portmap-wait.upstart	2013-08-10 22:27:10 +0000
@@ -0,0 +1,28 @@
+# portmap-wait 
+# Note that this is called portmap-wait rather than rpcbind-wait because
+# other packages rely on the portmap-wait name.
+
+description "Start this job to wait until rpcbind is started or fails to start"
+author "Clint Byrum <clint.byrum@canonical.com>"
+
+stop on started rpcbind or stopped rpcbind
+
+# Needed to make starting the job successful despite being killed
+normal exit 2
+task
+
+# We know that we have more than one job that needs to wait for rpcbind and
+# will make use of this service, so we need to instantiate.
+instance $WAITER
+
+script
+
+  status rpcbind | grep -q "start/running" && exit 0
+
+  start rpcbind ON_BOOT=y || true
+
+  # Waiting forever is ok.. upstart will kill this job when
+  # the rpcbind we tried to start above either starts or stops
+  while sleep 3600; do :; done
+
+end script

=== added file 'debian/rpcbind.rpcbind-boot.upstart'
--- a/debian/rpcbind.rpcbind-boot.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/rpcbind.rpcbind-boot.upstart	2013-08-10 21:18:15 +0000
@@ -0,0 +1,10 @@
+# portmap-boot
+
+description "Upstart job to start rpcbind on boot only"
+author "Clint Byrum"
+
+start on virtual-filesystems and net-device-up IFACE=lo
+
+task
+
+exec initctl emit --no-wait start-rpcbind ON_BOOT=y

=== added file 'debian/rpcbind.upstart'
--- a/debian/rpcbind.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/rpcbind.upstart	2013-08-10 23:19:18 +0000
@@ -0,0 +1,38 @@
+# rpcbind - RPC portmapper replacement
+
+# rpcbind is a server that converts RPC (Remote Procedure Call) program
+# numbers into DARPA protocol port numbers. It must be running in order
+# to make RPC calls.
+
+# Note that this is called portmap rather than rpcbind because other
+# packages rely on the portmap name.
+
+description	"RPC portmapper replacement"
+author		"Colin Watson <cjwatson@ubuntu.com>"
+
+start on start-rpcbind
+stop on unmounted-remote-filesystems
+
+# ON_BOOT is set on start-rpcbind in rpcbind-boot.conf
+# Used by statd which must not start on started portmap during boot
+export ON_BOOT
+env ON_BOOT=
+
+expect fork
+respawn
+
+pre-start exec mkdir -p /run/rpcbind
+
+script
+	OPTIONS="-w"
+	if [ -f /etc/default/rpcbind ]; then
+		. /etc/default/rpcbind
+	elif [ -f /etc/rpcbind.conf ]; then
+		. /etc/rpcbind.conf
+	fi
+	exec rpcbind $OPTIONS
+end script
+
+# For compatibility with older upstart jobs in Ubuntu
+post-start exec initctl emit --no-wait started portmap ON_BOOT=$ON_BOOT
+pre-stop exec initctl emit --no-wait stopping portmap

=== modified file 'debian/rules'
--- a/debian/rules	2012-06-16 00:02:37 +0000
+++ b/debian/rules	2013-08-10 23:10:19 +0000
@@ -72,7 +72,9 @@
 	dh_installdocs
 	dh_installexamples
 	dh_installman man/rpcinfo.7
-	dh_installinit -- start 43 S 2 3 4 5 . start 32 0 6 . stop 81 1 .
+	dh_installinit --no-start --name rpcbind-boot
+	dh_installinit --no-start --name portmap-wait
+	dh_installinit
 	dh_link
 	dh_strip
 	dh_compress

Attachment: signature.asc
Description: Digital signature


Reply to: