[asterisk-bugs] [Asterisk 0017485]: [patch] bashism in configure script

Asterisk Bug Tracker noreply at bugs.digium.com
Sun Jun 13 04:16:26 CDT 2010


A NOTE has been added to this issue. 
====================================================================== 
https://issues.asterisk.org/view.php?id=17485 
====================================================================== 
Reported By:                tzafrir
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   17485
Category:                   Core/BuildSystem
Reproducibility:            always
Severity:                   tweak
Priority:                   normal
Status:                     ready for testing
Asterisk Version:           SVN 
JIRA:                       SWP-1665 
Regression:                 No 
Reviewboard Link:            
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 268534 
Request Review:              
====================================================================== 
Date Submitted:             2010-06-07 12:38 CDT
Last Modified:              2010-06-13 04:16 CDT
====================================================================== 
Summary:                    [patch] bashism in configure script
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

====================================================================== 

---------------------------------------------------------------------- 
 (0123323) svnbot (reporter) - 2010-06-13 04:16
 https://issues.asterisk.org/view.php?id=17485#c123323 
---------------------------------------------------------------------- 
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 https://issues.asterisk.org/view.php?id=17485)
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 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2010-06-13 04:16 svnbot         Checkin                                      
2010-06-13 04:16 svnbot         Note Added: 0123323                          
======================================================================




More information about the asterisk-bugs mailing list