Summary:ASTERISK-21965: [patch] Bug-fixed version of safe_asterisk not installed over old version
Reporter:Jeremy Kister (jkister)Labels:
Date Opened:2013-06-27 00:43:35Date Closed:2014-06-12 02:50:33
Versions:11.4.0 11.5.0 Frequency of
Environment:Attachments:( 0) safe_asterisk.patch
s4> ps -ef | grep asterisk                    
root      5633 22285  0 01:42 pts/0    00:00:00 grep asterisk
s4> safe_asterisk
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
s4> ps -ef | grep asterisk
root      5587     1  0 01:42 pts/0    00:00:00 /bin/sh /usr/local/sbin/safe_asterisk
root      5589  5587  2 01:42 pts/0    00:00:00 /usr/local/sbin/asterisk -f -vvvg -c
root      5615 22285  0 01:42 pts/0    00:00:00 grep asterisk
Comments:By: Jeremy Kister (jkister) 2013-06-27 00:43:56.066-0500

Caused By/Related To: ASTERISK-11921

By: Jeremy Kister (jkister) 2013-06-27 00:48:14.538-0500

s4> grep "^VER" contrib/scripts/safe_asterisk
VERSION=`${ASTSBINDIR}/asterisk -nrx 'core show version' 2>/dev/null`

adding 2>/dev/null was going to be my fix in a patch.  my installed version of safe_asterisk does not contain 2>/dev/null:
s4> grep "^VER" /usr/local/sbin/safe_asterisk
VERSION=`${ASTSBINDIR}/asterisk -nrx 'core show version'`

By: Jeremy Kister (jkister) 2013-06-27 00:50:23.533-0500

i deleted my installed /usr/local/sbin/safe_asterisk and ran 'make install'.  the /new/ installed version of safe_asterisk is correct.

By: Jeremy Kister (jkister) 2013-06-27 00:55:23.715-0500

from Makefile:
       if [ ! -f "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" -a ! -f /sbin/launchd ]; then \
               cat contrib/scripts/safe_asterisk | sed 's|__ASTERISK_SBIN_DIR__|$(ASTSBINDIR)|;s|__ASTERISK_VARRUN_DIR__|$(ASTVARRUNDIR)|;s|__ASTERISK_LOG_DIR__|$(ASTLOGDIR)|;' > contrib/scripts/safe.tmp ; \
               $(INSTALL) -m 755 contrib/scripts/safe.tmp "$(DESTDIR)$(ASTSBINDIR)/safe_asterisk" ; \
               rm -f contrib/scripts/safe.tmp ; \

this means that when bugs are fixed in safe_asterisk, a 'make install' will not actually deploy the fix when users are upgrading.

By: Matt Jordan (mjordan) 2013-06-28 07:04:08.688-0500

Hm. I wonder why that check was in the Makefile in the first place. Odd.

Thanks for the patch!

By: Matt Jordan (mjordan) 2013-07-20 22:16:19.525-0500

After looking at this some more, I'm a little concerned about putting this into 1.8/11. It is annoying that it doesn't get re-installed on an upgrade; however, making it potentially blow out modifications to the safe_asterisk script that someone has made is worrisome. I'm fine with this going into trunk, particularly with the improvements to pulling parameters out of asterisk.conf.sample.

As such, I'm going to go ahead and commit this to trunk as an improvement.

By: Matt Jordan (mjordan) 2013-08-29 15:19:40.166-0500

Due to some criticisms of the approach taken with the patch that was applied, I've gone ahead and reverted this from 12/trunk and reopened this issue. Walter has proposed an alternative mechanism on Review Board here:


By: Jeremy Kister (jkister) 2013-09-02 00:43:54.506-0500

I would also vote against changing the NOTIFY default.  several pbx systems that i've installed do not have the ability to send mail.  sure, it could just be one more thing for folks like me to remember to turn off, though.

By: Walter Doekes (wdoekes) 2013-11-21 10:38:06.932-0600


Jeremy: Tzafrir justly noted that there already is a startup.d dir to use.

Can you alter every setting you need by using that? Or does the safe_asterisk script need tweaking? And if so, perhaps that would be the direction to take this..

By: Jeremy Kister (jkister) 2013-11-21 20:19:19.918-0600

I actually don't need any values tweaked -

I had concluded that the reason that safe_asterisk was not installed over an existing safe_asterisk was for fear that the script was modified.  I didnt realize the startup.d mechanism at all until now, which completely dissolves my theory on why 'make install' doesnt overwrite safe_asterisk.

By: Walter Doekes (wdoekes) 2013-11-22 02:06:36.788-0600

Drat :D

That means that you can trim your patch to only the Makefile bits (*and* add notes to the UPGRADE.txt files about the change while remarking startup.d as the solution).

And that means that I would have to fix my scripts to cope with being overwritten.. and probably patch safe_asterisk while doing that. But I'll wait with that until I have to :P

P.S. I didn't know about the startup.d either.

By: Jeremy Kister (jkister) 2013-11-22 03:14:25.001-0600

added to UPGRADE-11.txt.  Makefile now allows safe_asterisk to be installed on top of an existing safe_asterisk.

By: Walter Doekes (wdoekes) 2014-06-09 07:16:04.171-0500

Okay. So I've patched my safe_asterisk stuff now to work with getting overwritten.


Now this can get committed.

But where? [~mjordan]? 1.8, 11, 12?

I'd say 1.8 or 12 or trunk. 11 sounds like the worst alternative. (12 would suit me the best, since that one got all my patches.)

By: Matt Jordan (mjordan) 2014-06-10 07:31:05.871-0500

We previously went with 12/trunk before yanking it - I'd say 12+ is fine again for the reworked version.