[Asterisk-code-review] contrib: rc.archlinux.asterisk uses invalid redirect. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Mon Mar 6 12:13:26 CST 2023


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/19955 )

Change subject: contrib: rc.archlinux.asterisk uses invalid redirect.
......................................................................

contrib: rc.archlinux.asterisk uses invalid redirect.

`rc.archlinux.asterisk`, which explicitly requests bash in its
shebang, uses the following command syntax:

  ${DAEMON} -rx "core stop now" > /dev/null 2&>1

The intent of which is to execute:

  ${DAEMON} -rx "core stop now"

While sending both stdout and stderr to `/dev/null`. Unfortunately,
because the `&` is in the wrong place, bash is interpreting the `2` as
just an additional argument to the `$DAEMON` command and not as a file
descriptor and proceeds to use the bashism `&>` to send stderr and
stdout to a file named `1`.

So we clean it up and just use bash's shortcut syntax.

Issue raised and a fix suggested (but not used) by peutch on GitHub¹.

ASTERISK-30449 #close

1. https://github.com/asterisk/asterisk/pull/31

Change-Id: Ie279bf4efb4d95cbf507313483d316e977303d19
---
M contrib/init.d/rc.archlinux.asterisk
1 file changed, 33 insertions(+), 1 deletion(-)

Approvals:
  George Joseph: Looks good to me, approved
  N A: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit




diff --git a/contrib/init.d/rc.archlinux.asterisk b/contrib/init.d/rc.archlinux.asterisk
index 9c84085..47685ad 100755
--- a/contrib/init.d/rc.archlinux.asterisk
+++ b/contrib/init.d/rc.archlinux.asterisk
@@ -45,7 +45,7 @@
   stop)
     if [ -r ${ASTVARRUNDIR}/asterisk.pid ]; then
       stat_busy "Stopping Asterisk..."
-      ${DAEMON} -rx "core stop now" > /dev/null 2&>1
+      ${DAEMON} -rx "core stop now" &>/dev/null
       if [ $? -gt 0 ]; then
         stat_fail
       else

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19955
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: Ie279bf4efb4d95cbf507313483d316e977303d19
Gerrit-Change-Number: 19955
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: N A <asterisk at phreaknet.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230306/376ae837/attachment.html>


More information about the asterisk-code-review mailing list