[Home]

Summary:ASTERISK-16220: [patch] bashism in configure script
Reporter:Tzafrir Cohen (tzafrir)Labels:
Date Opened:2010-06-07 12:38:54Date Closed:2011-05-04 02:13:20
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/BuildSystem
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 0001-remove-bashism-from-ast_check_pwlib.m4.patch
Description:Following a thread in debian-devel[1], I figured I better fix the issue with Asterisk, before it starts to actually bite people in the wild.

dash is the default /bin/sh on many systems. However, the autoconf configure script will attempt to fall back to bash (if available) if /bin/sh is not a proper shell. One feature that separated dash from being a proper shell is providing $LINENO.

As it happens, a recent version of dash finally was able to provide $LINENO. It was uploaded to Debian Unstable. And configure scripts started breaking all over the place. The scripts generated by autoconf use proper POSIX syntax, but often the extra shell snippets use bash extensions.

That specific version of dash was reverted later on (see down that thread). But it will come up sooner or later. So it is worth fixing those issues at some point.

A quick check with checkbashism (of the package devscripts) brought up only two cases:

* configure.ac:229: $RANDOM used. Only used if mktemp not available
* autoconf/ast_check_pwlib.m4:215 - use 'let'. Can be easily replaced with $(( )) or expr.

Here's how I (hopefully) worked around the test in the configure script for LINENO:

 sed -i -e 's/\(as_lineno_\([12]\)=\).*$/\1\2/' configure

[1] http://lists.debian.org/debian-devel/2010/05/msg00892.html
Comments:By: Russell Bryant (russell) 2010-06-10 11:46:10

looks fine to me, feel free to just commit it

By: Digium Subversion (svnbot) 2010-06-13 04:16:25

Repository: asterisk
Revision: 270184

U   trunk/autoconf/ast_check_pwlib.m4
U   trunk/configure

------------------------------------------------------------------------
r270184 | tzafrir | 2010-06-13 04:16:25 -0500 (Sun, 13 Jun 2010) | 9 lines

bashism in configure script

Theoretically the ./configure script is a pure bourne-shell script.
Practically it may be run by bash if /bin/sh is not good enough. But we should not count on it. See bug report for the gory details.

(closes issue ASTERISK-16220)
Patches:
     0001-remove-bashism-from-ast_check_pwlib.m4.patch uploaded by tzafrir (license 46)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=270184

By: Tzafrir Cohen (tzafrir) 2011-04-30 07:29:39

Issue was re-introduced in r278985 (due to a forward-port from 1.4 that didn't have this fix). I guess it needs to be fixed in 1.8 and trunk.

Thanks to Jilles Tjoelker for the report.

By: Digium Subversion (svnbot) 2011-05-03 13:26:57

Repository: asterisk
Revision: 316193

U   branches/1.8/autoconf/ast_check_pwlib.m4
U   branches/1.8/configure

------------------------------------------------------------------------
r316193 | tzafrir | 2011-05-03 13:26:56 -0500 (Tue, 03 May 2011) | 8 lines

Re-fix bashism in ./configure: s/let/$(( ))/

A forward-port in r278985 accidentally re-introduced issue 17485. Fixing
it. Thanks to Jilles Tjoelker for the good report.

(closes issue ASTERISK-16220)


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=316193

By: Digium Subversion (svnbot) 2011-05-04 02:13:20

Repository: asterisk
Revision: 316520

_U  trunk/
U   trunk/autoconf/ast_check_pwlib.m4
U   trunk/configure

------------------------------------------------------------------------
r316520 | tzafrir | 2011-05-04 02:13:19 -0500 (Wed, 04 May 2011) | 14 lines

Merged revisions 316193 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r316193 | tzafrir | 2011-05-03 13:57:16 +0300 (?\215?\146', 03 ?\215?\158?\215?\144?\215?\153 2011) | 8 lines
 
 Re-fix bashism in ./configure: s/let/$(( ))/
 
 A forward-port in r278985 accidentally re-introduced issue 17485. Fixing
 it. Thanks to Jilles Tjoelker for the good report.
 
 (closes issue ASTERISK-16220)
........

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=316520