Bug#772191: armagetronad-dedicated: bashism in /bin/sh script
Markus Koschany
apo at gambaru.de
Sat Dec 6 10:22:22 UTC 2014
Control: tags -1 confirmed patch
On 06.12.2014 01:09, Raphael Geissert wrote:
> Package: armagetronad-dedicated
> Severity: serious
> Version: 0.2.8.3.2-2
> User: debian-release at lists.debian.org
> Usertags: goal-dash
>
> Hi,
>
> I've ran checkbashisms (from the 'devscripts' package) over the whole
> archive and I found that your package has a /bin/sh script that uses a
> "bashism".
And I thought the last revision fixed all of those.. I have prepared a
new one that removes the run_continuous function completely because I
don't see a real value for people. I would usually recommend a real
monitoring solution like monit or systemd's built-in features to ensure
that the server will be restarted after crashes. The shell code was
rather hackish in this way.
A second PID file became useless after this change, so I removed the
STARTERPIDFILE option from /etc/default/armagetronad-dedicated and
updated the corresponding init script. I verified that the server still
works as expected.
I also fixed two minor issues in Debian's copyright file and upstream's
desktop file. I think both are small enough to get accepted by the
release team.
I am attaching the debdiff against the version in testing. All changes
are also available from the Git repository.
Markus
-------------- next part --------------
diff -Nru armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.default armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.default
--- armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.default 2014-08-28 06:10:51.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.default 2014-12-06 11:03:15.000000000 +0100
@@ -9,7 +9,6 @@
LOGDIR=/var/log
# pidfile names.
NAME=armagetronad-dedicated
-STARTERPIDFILE=$PIDDIR/$NAME-starter.pid
MAINPIDFILE=$PIDDIR/$NAME.pid
# Logfile.
LOGFILE=$LOGDIR/$NAME.log
diff -Nru armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.init armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.init
--- armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.init 2014-08-28 06:10:51.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/armagetronad-dedicated.init 2014-12-06 11:03:15.000000000 +0100
@@ -46,7 +46,14 @@
run()
{
- /sbin/start-stop-daemon --start --quiet --chuid $ARMAGETRONAD_USER --oknodo --pidfile $STARTERPIDFILE --nicelevel $NICENESS --exec $DAEMON >$LOGFILE &
+ start-stop-daemon \
+ --start \
+ --quiet \
+ --chuid $ARMAGETRONAD_USER \
+ --oknodo \
+ --pidfile $MAINPIDFILE \
+ --nicelevel $NICENESS \
+ --exec $DAEMON >$LOGFILE &
}
case "$1" in
@@ -61,11 +68,9 @@
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
- # Kill both the starter keepalive script and server.
- /sbin/start-stop-daemon --stop --pidfile $STARTERPIDFILE --quiet --oknodo $DAEMON
- /sbin/start-stop-daemon --stop --pidfile $MAINPIDFILE --quiet --oknodo $DAEMON.real
+ start-stop-daemon --stop --pidfile $MAINPIDFILE --quiet --oknodo || return 1
log_end_msg $?
- rm -f $STARTERPIDFILE $MAINPIDFILE
+ rm -f $MAINPIDFILE
;;
restart|force-reload)
$0 stop
diff -Nru armagetronad-0.2.8.3.2/debian/bin/armagetronad-dedicated armagetronad-0.2.8.3.2/debian/bin/armagetronad-dedicated
--- armagetronad-0.2.8.3.2/debian/bin/armagetronad-dedicated 2014-08-29 08:58:53.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/bin/armagetronad-dedicated 2014-12-06 11:03:15.000000000 +0100
@@ -20,35 +20,6 @@
echo Terminated
}
-run_continuous()
-{
- # local variable for keeping track of start times.
- local STARTDATE_LOG
- echo $$ > $STARTERPIDFILE
- while true; do
- STARTDATE=`date +%s`
- run
-
- # Give up if restarts come too quickly; ten per minute is suspicious.
- OLDESTSTART=${STARTDATE_LOG[1]}
- if [ ! -z "$OLDESTSTART" ]; then
- TIMESPENT=$(($STARTDATE - $OLDESTSTART))
- if [ ${TIMESPENT} -lt 60]; then
- echo "Stopping server, it is restarting too quickly."
- rm -f $STARTERPIDFILE
- rm -f $MAINPIDFILE
- exit
- fi
- fi
-
- # Keep log of past start dates.
- for f in 1 2 3 4 5 6 7 8 9; do
- next=$(( $f + 1))
- STARTDATE_LOG[$f]=${STARTDATE_LOG[$next]}
- done
- STARTDATE_LOG[10]=${STARTDATE}
- done
-}
# Still allow other arguments to be executed, e.g. --doc
if [ "$1" != "" ]; then
@@ -56,5 +27,5 @@
exit 0
fi
-# Run and keep-alive in case of crashes.
-run_continuous
+# Run the server
+run
diff -Nru armagetronad-0.2.8.3.2/debian/changelog armagetronad-0.2.8.3.2/debian/changelog
--- armagetronad-0.2.8.3.2/debian/changelog 2014-08-29 08:58:53.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/changelog 2014-12-06 11:03:15.000000000 +0100
@@ -1,3 +1,17 @@
+armagetronad (0.2.8.3.2-3) unstable; urgency=medium
+
+ * Fix all remaining bashisms in armagetronad-dedicated wrapper script by
+ removing the run_continuous function. Users are advised to use a real
+ monitoring solution like Monit instead.
+ As a consequence do not use a second PID file for the server and remove the
+ STARTERPIDFILE option from /etc/default/armagetron-dedicated because it is
+ useless now. (Closes: #772191)
+ * armagetronad.desktop: Fix lintian warning desktop-mime-but-no-exec-code by
+ adding %f parameter to Exec key. Add Forwarded header.
+ * debian/copyright: Fix wrong path to public-domain licensed files.
+
+ -- Markus Koschany <apo at gambaru.de> Sat, 06 Dec 2014 11:02:22 +0100
+
armagetronad (0.2.8.3.2-2) unstable; urgency=medium
* New maintainer Debian Games Team.
diff -Nru armagetronad-0.2.8.3.2/debian/copyright armagetronad-0.2.8.3.2/debian/copyright
--- armagetronad-0.2.8.3.2/debian/copyright 2014-08-28 06:10:51.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/copyright 2014-12-06 11:03:15.000000000 +0100
@@ -8,7 +8,7 @@
2000-2011, Armagetron Advanced development team
License: GPL-2+
-Files: src/binreloc/*
+Files: src/thirdparty/binreloc/*
Copyright: Mike Hearn <mike at theoretic.com>
Hongli Lai <h.lai at chello.nl>
License: public-domain
diff -Nru armagetronad-0.2.8.3.2/debian/patches/desktop-file.patch armagetronad-0.2.8.3.2/debian/patches/desktop-file.patch
--- armagetronad-0.2.8.3.2/debian/patches/desktop-file.patch 2014-08-28 06:10:51.000000000 +0200
+++ armagetronad-0.2.8.3.2/debian/patches/desktop-file.patch 2014-12-06 11:03:15.000000000 +0100
@@ -2,17 +2,21 @@
Date: Tue, 26 Aug 2014 23:42:04 +0200
Subject: desktop file
+Forwarded: http://forums3.armagetronad.net/viewtopic.php?f=4&t=23750
---
- desktop/armagetronad.desktop.in | 4 +++-
- 1 file changed, 3 insertions(+), 1 deletion(-)
+ desktop/armagetronad.desktop.in | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/desktop/armagetronad.desktop.in b/desktop/armagetronad.desktop.in
-index eeee58b..82747b0 100644
+index eeee58b..8b5eb77 100644
--- a/desktop/armagetronad.desktop.in
+++ b/desktop/armagetronad.desktop.in
-@@ -3,9 +3,11 @@ Type=Application
+@@ -1,11 +1,13 @@
+ [Desktop Entry]
+ Type=Application
Name=@progtitle@@progtitle_server@
- Exec=@progname@
+-Exec=@progname@
++Exec=@progname@ %f
Comment=3d light cycle game
-Icon=@progname at .png
+Comment[de]=dreidimensionales Lichtradspiel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-games-devel/attachments/20141206/8b708614/attachment-0001.sig>
More information about the Pkg-games-devel
mailing list