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

Bug#848365: jessie-pu: package coquelicot/0.9.2-4+deb8u1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

Hi!

I would like to important issues affecting coquelicot in jessie:

#809351: properly run coquelicot under the 'coquelicot' user and not
as root. It was always intended that way, that's why the cron is running
under the coquelicot user already. The issue has been fixed a while ago
for stretch (in 0.9.4-1, uploaded September 2015). This backports the
changes from the unstable branch which switched to using
init-d-script(5).

#808018: silence deprecation warnings coming from cron. While the
warnings actually come from ruby-fast-gettext, they make the garbage
collection cron send an email on every run.

debdiff is attached.

Better late than never the old issues, and thanks for your review!

-- 
Lunar                                .''`. 
lunar@debian.org                    : :Ⓐ  :  # apt-get install anarchism
                                    `. `'` 
                                      `-   
diff -Nru coquelicot-0.9.2/debian/changelog coquelicot-0.9.2/debian/changelog
--- coquelicot-0.9.2/debian/changelog	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/changelog	2016-12-16 18:08:03.000000000 +0100
@@ -1,3 +1,14 @@
+coquelicot (0.9.2-4+deb8u1) stable; urgency=medium
+
+  * Backport init.d fixes from stretch to properly run the daemon as
+    coquelicot:coquelicot. Thanks Edouard GAULUE for noticing this
+    needed to be fixed in jessie. (Closes: #809351)
+  * Suppress deprecation warnings when running the daemon and garbage
+    collection in cron. Thanks Matteo Calorio for the report.
+    (Closes: #808018)
+
+ -- Jérémy Bobbio <lunar@debian.org>  Fri, 16 Dec 2016 18:08:03 +0100
+
 coquelicot (0.9.2-4) unstable; urgency=medium
 
   * Fix Build-Depends for activesupport. (Closes: #759921)
diff -Nru coquelicot-0.9.2/debian/control coquelicot-0.9.2/debian/control
--- coquelicot-0.9.2/debian/control	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/control	2016-12-16 17:46:12.000000000 +0100
@@ -54,6 +54,7 @@
          ruby-sinatra-contrib,
          ruby-upr,
          ruby | ruby-interpreter,
+         sysvinit-utils (>= 2.88dsf-50),
          ${misc:Depends},
          ${shlibs:Depends}
 Recommends: apache2 | nginx | pound
diff -Nru coquelicot-0.9.2/debian/coquelicot.cron.d coquelicot-0.9.2/debian/coquelicot.cron.d
--- coquelicot-0.9.2/debian/coquelicot.cron.d	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/coquelicot.cron.d	2016-12-16 18:07:45.000000000 +0100
@@ -1,4 +1,4 @@
 # crontab fragment for coquelicot
 
 # Run the garbage collection procedure every 15 minutes
-11,26,41,56 * * * * coquelicot [ -x /usr/bin/coquelicot ] && [ -f /etc/coquelicot/settings.yml ] && /usr/bin/coquelicot gc
+11,26,41,56 * * * * coquelicot [ -x /usr/bin/coquelicot ] && [ -f /etc/coquelicot/settings.yml ] && RUBYOPT="-W0" /usr/bin/coquelicot gc
diff -Nru coquelicot-0.9.2/debian/coquelicot.init.d coquelicot-0.9.2/debian/coquelicot.init.d
--- coquelicot-0.9.2/debian/coquelicot.init.d	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/coquelicot.init.d	2016-12-16 18:07:45.000000000 +0100
@@ -1,4 +1,8 @@
 #!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
 ### BEGIN INIT INFO
 # Provides:          coquelicot
 # Required-Start:    $remote_fs
@@ -10,91 +14,38 @@
 #                    with a focus on protecting users' privacy.
 ### END INIT INFO
 
-# Do NOT "set -e"
+# Author: Jérémy Bobbio <lunar@debian.org>
 
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
 DESC='Coquelicot "one-click" file sharing web application'
-NAME=coquelicot
 DAEMON=/usr/bin/coquelicot
 DAEMON_ARGS="start"
-PIDFILE=/var/run/$NAME.pid
-SCRIPTNAME=/etc/init.d/$NAME
+PIDFILE=/var/run/coquelicot/coquelicot.pid
 
-. /lib/lsb/init-functions
+# can be overriden in /etc/default/coquelicot
+USER=coquelicot
+GROUP=coquelicot
 
-do_start()
-{
-	start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
-		|| return 1
-	LC_ALL=C.UTF-8 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
-		$DAEMON_ARGS \
-		|| return 2
+
+do_start_prepare() {
+	START_ARGS="--chuid $USER:$GROUP"
+	/usr/bin/install -m 02750 -o "$USER" -g "$USER" -d "$(dirname "$PIDFILE")"
+
+	# suppress deprecation warnings
+	export RUBYOPT="-W0"
 }
 
-do_stop()
-{
-	start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
+# We can't use init-d-script(5) do_stop_cmd() because it matches on the
+# executable path and Coquelicot is written in Ruby. So this is almost
+# the same function but without `--exec` when calling `start-stop-daemon`.
+# We still send QUIT before sending TERM to be hope that worker will
+# terminate gracefully.
+do_stop_cmd() {
+	start-stop-daemon --stop --quiet --retry=QUIT/5/TERM/5/KILL/5 \
+	    $STOP_ARGS \
+	    ${PIDFILE:+--pidfile ${PIDFILE}} --name $NAME
 	RETVAL="$?"
 	[ "$RETVAL" = 2 ] && return 2
-	start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
-	[ "$?" = 2 ] && return 2
-	rm -f "$PIDFILE"
-	return "$RETVAL"
+	# Many daemons don't delete their pidfiles when they exit.
+	rm -f $PIDFILE
+	return $RETVAL
 }
-
-do_reopen_logs()
-{
-	start-stop-daemon --stop --signal USR1 --quiet --oknodo --pidfile $PIDFILE
-}
-
-case "$1" in
-    start)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
-	do_start
-	case "$?" in
-	    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-	    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-	esac
-	;;
-    stop)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-	    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-	esac
-	;;
-    status)
-	status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
-	;;
-    restart|force-reload)
-	log_daemon_msg "Restarting $DESC" "$NAME"
-	do_stop
-	case "$?" in
-	  0|1)
-		do_start
-		case "$?" in
-			0) log_end_msg 0 ;;
-			1) log_end_msg 1 ;; # Old process is still running
-			*) log_end_msg 1 ;; # Failed to start
-		esac
-		;;
-	  *)
-		# Failed to stop
-		log_end_msg 1
-		;;
-	esac
-	;;
-    reopen-logs)
-	[ "$VERBOSE" != no ] && log_daemon_msg "Reopening log files of $DESC" "$NAME"
-	do_reopen_logs
-	case "$?" in
-	    0) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
-	    *) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
-	esac
-	;;
-  *)
-	echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload|reopen-logs}" >&2
-	exit 3
-	;;
-esac
diff -Nru coquelicot-0.9.2/debian/coquelicot.logrotate coquelicot-0.9.2/debian/coquelicot.logrotate
--- coquelicot-0.9.2/debian/coquelicot.logrotate	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/coquelicot.logrotate	2016-12-16 18:07:45.000000000 +0100
@@ -7,7 +7,7 @@
 	su coquelicot coquelicot
 
 	lastaction
-	invoke-rc.d coquelicot reopen-logs
+		start-stop-daemon --stop --signal USR1 --quiet --oknodo --pidfile /var/run/coquelicot/coquelicot.pid
 	endscript
 }
 
diff -Nru coquelicot-0.9.2/debian/coquelicot.postinst coquelicot-0.9.2/debian/coquelicot.postinst
--- coquelicot-0.9.2/debian/coquelicot.postinst	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/coquelicot.postinst	2016-12-16 18:07:45.000000000 +0100
@@ -4,7 +4,14 @@
 
 case "$1" in
     configure)
-	if ! id coquelicot >/dev/null 2>&1; then
+	if id coquelicot >/dev/null 2>&1; then
+		if dpkg --compare-versions "$2" lt 0.9.2-4+deb8u1~; then
+			# Change owner of stored files now that we will run
+			# as 'coquelicot' and not root.
+			find /var/lib/coquelicot /var/log/coquelicot -type f -uid 0 -print0 | xargs -0r chown coquelicot
+			find /var/lib/coquelicot /var/log/coquelicot -type f -gid 0 -print0 | xargs -0r chgrp "$(id -g coquelicot)"
+		fi
+	else
 		adduser --system --group --gecos "Coquelicot web application" \
 			--no-create-home \
 			--home /var/lib/coquelicot coquelicot >/dev/null
diff -Nru coquelicot-0.9.2/debian/coquelicot.postrm coquelicot-0.9.2/debian/coquelicot.postrm
--- coquelicot-0.9.2/debian/coquelicot.postrm	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/coquelicot.postrm	2016-12-16 17:46:12.000000000 +0100
@@ -5,6 +5,7 @@
 case "$1" in
     purge)
 	rm -rf /etc/coquelicot
+	rm -rf /var/run/coquelicot
 	rm -rf /var/lib/coquelicot
 	rm -rf /var/log/coquelicot
 	;;
diff -Nru coquelicot-0.9.2/debian/patches/0005-Adjust-paths-to-fit-Debian-packaging.patch coquelicot-0.9.2/debian/patches/0005-Adjust-paths-to-fit-Debian-packaging.patch
--- coquelicot-0.9.2/debian/patches/0005-Adjust-paths-to-fit-Debian-packaging.patch	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/patches/0005-Adjust-paths-to-fit-Debian-packaging.patch	2016-12-16 18:07:45.000000000 +0100
@@ -40,7 +40,7 @@
      set :additional_css, ''
 -    set :pid, Proc.new { File.join(root, 'tmp/coquelicot.pid') }
 -    set :log, Proc.new { File.join(root, 'tmp/coquelicot.log') }
-+    set :pid, '/var/run/coquelicot.pid'
++    set :pid, '/var/run/coquelicot/coquelicot.pid'
 +    set :log, '/var/log/coquelicot/coquelicot.log'
      set :listen, [ "127.0.0.1:51161" ]
      set :show_exceptions, false
diff -Nru coquelicot-0.9.2/debian/settings.yml coquelicot-0.9.2/debian/settings.yml
--- coquelicot-0.9.2/debian/settings.yml	2014-09-01 18:08:55.000000000 +0200
+++ coquelicot-0.9.2/debian/settings.yml	2016-12-16 17:46:12.000000000 +0100
@@ -81,7 +81,7 @@
 additional_css: ""
 
 # Path to the PID file of the web server
-pid: "/var/run/coquelicot.pid"
+pid: "/var/run/coquelicot/coquelicot.pid"
 
 # Path to Coquelicot log file
 #

Attachment: signature.asc
Description: Digital signature


Reply to: