Summary: | ASTERISK-12050: [patch] rc.debian.asterisk ubuntu 8.04 hardy | ||
Reporter: | Ronald Chan (loloski) | Labels: | |
Date Opened: | 2008-05-19 21:54:19 | Date Closed: | 2008-05-30 11:51:30 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | General |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 12687-return.diff ( 1) 20080529-12687-safe_asterisk-fixversion.diff.txt ( 2) rc.debian.asterisk.diff | |
Description: | Good day, today i stumble on hardy as to how asterisk would start, i found out that this particular section of script if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t" echo "Asterisk is already running. $0 will exit now." exit 1 fi is not applicable if your are using a #!/bin/sh interpreter instead of #!/bin/bash, on redhat system or equivalent /bin/sh is a symlink of /bin/bash a simple fix for this is to replace #!/bin/sh with #!/bin/bash or please see attached patch for details ****** ADDITIONAL INFORMATION ****** Index: rc.debian.asterisk =================================================================== --- rc.debian.asterisk (revision 117256) +++ rc.debian.asterisk (working copy) @@ -55,7 +55,7 @@ # Check if Asterisk is already running. If it is, then bug out, because # starting up Asterisk when Asterisk is already running is very bad. VERSION=`${DAEMON} -rx 'core show version' || ${TRUE}` - if [ "${VERSION:0:8}" = "Asterisk" ]; then # otherwise "Unable t" + if [ "$VERSION:0:8" = "Asterisk" ]; then # otherwise "Unable t" echo "Asterisk is already running. $0 will exit now." exit 1 fi | ||
Comments: | By: Ronald Chan (loloski) 2008-05-19 21:57:41 without the attach patch or tweak this result to venus@venus:~/asterisk/asterisk/contrib/init.d$ sudo /etc/init.d/asterisk start /etc/init.d/asterisk: 96: Bad substitution venus@venus:~/asterisk/asterisk/contrib/init.d$ By: Ronald Chan (loloski) 2008-05-19 22:16:45 this is a minor annoyance, but a show stopper for starters on debian derivatives IMHO :). By: Jason Parker (jparker) 2008-05-20 10:22:26 Could you give this patch a try? By: Ronald Chan (loloski) 2008-05-20 11:20:20 qwell, I verified, your attach patch works By: Ronald Chan (loloski) 2008-05-20 11:36:56 Qwell, I think your patch is more portable regardless of what shell will be used counting shell argument $? return by ${VERSION} is much simpler and better. :) By: Ronald Chan (loloski) 2008-05-22 12:10:55 Good day, can someone pick this up and apply qwell's patch so that we can close this bug? By: Tzafrir Cohen (tzafrir) 2008-05-23 18:56:44 While it sort of fixes the immediate issue (bashism), this is still broken: there are better ways to check for a process that leaves a PID file. This will break if there is another instance of Asterisk that uses a different PID file. Worse, it will hang the init script altogether if the asterisk process is there bug does not respond. (and may be meaningless in the case of safe_asterisk, of course). By: Michiel van Baak (mvanbaak) 2008-05-29 14:28:40 how about this ? This works on: Debian etch Ubuntu Hardy Heron OpenBSD 4.3 By: Michiel van Baak (mvanbaak) 2008-05-29 14:29:59 hhmm, I patched it in safe_asterisk only. But you get the idea. If you want I can patch it in rc.debian.asterisk as well By: Ronald Chan (loloski) 2008-05-29 22:22:43 mvanbaak, if this is the right candidate fix and agreed upon by others, go ahead and commit it, i tested your fix and it seems to be working. Tested on Hardy, FC9 Thanks By: Digium Subversion (svnbot) 2008-05-30 11:38:32 Repository: asterisk Revision: 119301 U branches/1.4/contrib/init.d/rc.debian.asterisk U branches/1.4/contrib/init.d/rc.gentoo.asterisk U branches/1.4/contrib/init.d/rc.mandrake.asterisk U branches/1.4/contrib/init.d/rc.redhat.asterisk U branches/1.4/contrib/init.d/rc.slackware.asterisk U branches/1.4/contrib/init.d/rc.suse.asterisk U branches/1.4/contrib/scripts/safe_asterisk ------------------------------------------------------------------------ r119301 | mvanbaak | 2008-05-30 11:38:26 -0500 (Fri, 30 May 2008) | 14 lines dont use a bashism way to check the $VERSION variable. The rc/init.d scripts, and safe_asterisk work on normal sh now again. Tested on: OpenBSD 4.2 (me) Debian etch (me) Ubuntu Hardy (me and loloski) FC9 (loloski) (closes issue ASTERISK-12050) Reported by: loloski Patches: 20080529-12687-safe_asterisk-fixversion.diff.txt uploaded by mvanbaak (license 7) Tested by: loloski, mvanbaak ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119301 By: Digium Subversion (svnbot) 2008-05-30 11:41:08 Repository: asterisk Revision: 119302 _U trunk/ U trunk/contrib/init.d/rc.debian.asterisk U trunk/contrib/init.d/rc.gentoo.asterisk U trunk/contrib/init.d/rc.mandrake.asterisk U trunk/contrib/init.d/rc.redhat.asterisk U trunk/contrib/init.d/rc.slackware.asterisk U trunk/contrib/init.d/rc.suse.asterisk U trunk/contrib/scripts/safe_asterisk ------------------------------------------------------------------------ r119302 | mvanbaak | 2008-05-30 11:40:58 -0500 (Fri, 30 May 2008) | 22 lines Merged revisions 119301 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119301 | mvanbaak | 2008-05-30 18:44:39 +0200 (Fri, 30 May 2008) | 14 lines dont use a bashism way to check the $VERSION variable. The rc/init.d scripts, and safe_asterisk work on normal sh now again. Tested on: OpenBSD 4.2 (me) Debian etch (me) Ubuntu Hardy (me and loloski) FC9 (loloski) (closes issue ASTERISK-12050) Reported by: loloski Patches: 20080529-12687-safe_asterisk-fixversion.diff.txt uploaded by mvanbaak (license 7) Tested by: loloski, mvanbaak ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119302 By: Digium Subversion (svnbot) 2008-05-30 11:51:30 Repository: asterisk Revision: 119303 _U branches/1.6.0/ U branches/1.6.0/contrib/init.d/rc.debian.asterisk U branches/1.6.0/contrib/init.d/rc.gentoo.asterisk U branches/1.6.0/contrib/init.d/rc.mandrake.asterisk U branches/1.6.0/contrib/init.d/rc.redhat.asterisk U branches/1.6.0/contrib/init.d/rc.slackware.asterisk U branches/1.6.0/contrib/init.d/rc.suse.asterisk U branches/1.6.0/contrib/scripts/safe_asterisk ------------------------------------------------------------------------ r119303 | mvanbaak | 2008-05-30 11:51:26 -0500 (Fri, 30 May 2008) | 30 lines Merged revisions 119302 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r119302 | mvanbaak | 2008-05-30 18:47:24 +0200 (Fri, 30 May 2008) | 22 lines Merged revisions 119301 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r119301 | mvanbaak | 2008-05-30 18:44:39 +0200 (Fri, 30 May 2008) | 14 lines dont use a bashism way to check the $VERSION variable. The rc/init.d scripts, and safe_asterisk work on normal sh now again. Tested on: OpenBSD 4.2 (me) Debian etch (me) Ubuntu Hardy (me and loloski) FC9 (loloski) (closes issue ASTERISK-12050) Reported by: loloski Patches: 20080529-12687-safe_asterisk-fixversion.diff.txt uploaded by mvanbaak (license 7) Tested by: loloski, mvanbaak ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=119303 |