[Home]

Summary:ASTERISK-20567: bashism in autosupport
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2012-10-16 06:26:31Date Closed:2012-10-18 08:29:54
Priority:MinorRegression?
Status:Closed/CompleteComponents:General
Versions:1.8.17.0 10.9.0 11.0.0-beta2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 0001-fix-bashism-in-autosupport.patch
Description:The script contrib/scripts/autosupport has bashism issues: it is a #!/bin/sh script but uses some bash-specific features. From what I see, it's only the usage of '==' for string comparison in a 'test'.

Anyway, that whole part better be written as a 'case' statement. Patch attached.

While we're at it, including /dev/zap and /dev/dahdi in line 207 is not a good idea. Currently it will just grab randome files called 1, 2, or whatever and 'ctl' and such in the current directory. But even if you fix that, you should not try to read the contents of those special device files.

Is this script still being used? Should it still be included in the Debian package?
( http://bugs.debian.org/690627 triggered this).
Comments:By: Walter Doekes (wdoekes) 2012-10-18 03:48:12.733-0500

Didn't you commit this already?

By: Matt Jordan (mjordan) 2012-10-18 08:29:48.064-0500

Yup.  I'll have to take a look at the subversion hook that auto-closes issues to see if it needs a swift kick.

By: Jeremy Lainé (sharky) 2014-09-29 14:35:06.223-0500

I am not sure where you commited this patch, it's definitely not applied as recently as 11.13.0

By: Walter Doekes (wdoekes) 2014-09-29 16:13:30.234-0500

Tzafrir forgot to merge to trunk, looks like:
{noformat}
$ svn log asterisk-1.8.x-WRITE/contrib/scripts/autosupport
------------------------------------------------------------------------
r375059 | tzafrir | 2012-10-16 21:13:08 +0200 (di, 16 okt 2012) | 7 lines

autosupport: fix bashism

'==' is bashism (bashspecific, fails when dash is /bin/sh). Anyway, a
'case' works better there.

(closes issue ASTERISK-20567)
Reported by: Tzafrir Cohen
------------------------------------------------------------------------
r349504 | kmoore | 2012-01-04 21:00:33 +0100 (wo, 04 jan 2012) | 10 lines

Update autosupport script and man page

Added information collection from the output of the utilities: top, free, uptime, ifconfig
Added information collection from the output of the Asterisk command 'dahdi show status'
Added option / flag '-n, --non-interactive'
Updated man page to reflect new option / flag '-n, --non-interactive'

Patch-by: John Bigelow (itzanger)
(closes issue AST-749)

{noformat}

vs.

{noformat}
$ svn log asterisk-11.x-WRITE/contrib/scripts/autosupport
------------------------------------------------------------------------
r371121 | mjordan | 2012-08-10 22:08:14 +0200 (vr, 10 aug 2012) | 8 lines

     _        _            _     _      _   _
    / \   ___| |_ ___ _ __(_)___| | __ / | / |
   / _ \ / __| __/ _ \ '__| / __| |/ / | | | |
  / ___ \__  \|  | __/ |  | \__ \   <  | | | |
 /_/   \_\___/\__\___|_|  |_|___/_|\_\ |_| |_|

Because it's one greater than 10.

------------------------------------------------------------------------
r349506 | kmoore | 2012-01-04 21:02:34 +0100 (wo, 04 jan 2012) | 16 lines

Update autosupport script and man page

Added information collection from the output of the utilities: top, free, uptime, ifconfig
Added information collection from the output of the Asterisk command 'dahdi show status'
Added option / flag '-n, --non-interactive'
Updated man page to reflect new option / flag '-n, --non-interactive'

Patch-by: John Bigelow (itzanger)
(closes issue AST-749)
........

Merged revisions 349504 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 349505 from http://svn.asterisk.org/svn/asterisk/branches/10

{noformat}

By: Walter Doekes (wdoekes) 2014-09-29 16:29:52.818-0500

Ok. Committed now.