[asterisk-bugs] [Asterisk 0012883]: build_tools/strip_nonapi 1.4/1.6 may run strip with -N as last argument

noreply at bugs.digium.com noreply at bugs.digium.com
Thu Jun 19 11:19:05 CDT 2008


The following issue has been RESOLVED. 
====================================================================== 
http://bugs.digium.com/view.php?id=12883 
====================================================================== 
Reported By:                Nik Soggia
Assigned To:                svnbot
====================================================================== 
Project:                    Asterisk
Issue ID:                   12883
Category:                   General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     resolved
Asterisk Version:           1.6.0-beta6 
SVN Branch (only for SVN checkouts, not tarball releases): N/A 
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
Resolution:                 fixed
Fixed in Version:           
====================================================================== 
Date Submitted:             06-18-2008 11:00 CDT
Last Modified:              06-19-2008 11:19 CDT
====================================================================== 
Summary:                    build_tools/strip_nonapi 1.4/1.6 may run strip with
-N as last argument
Description: 
it happens on some old systems (mine is slackware 10.2), newer system are
unlikely to be affected because today command lines can be longer than some
time ago.

when the whole list of arguments generated by "sed" cannot fit in a single
command execution, "xargs" will run "strip" a few times.
"-N" and its argument are not guaranteed to stay together because they are
separated by spaces.

the bug can be reproduced with a bit of luck, replacing "xargs" with
"xargs -s 1000" and decrementing "1000" by 5 until one execution ends with
"-N" and the next one starts with the symbol name without the "-N" in
front.

I solved the problem with this:
sed -i 's|/-N /|/--strip-symbol=/|g' build_tools/strip_nonapi
before running the top-level make.

with this workaround "xargs" still splits its stdin, but as long as
symbols don't contain spaces the resulting command-line should be always
correct.

I hope that this workaround is portable, if not, we may have to add a
check such as:

if "${STRIP}" 2>&1 | grep -q -e --strip-symbol ; then
    echo you may use "--strip-symbol="
else
    echo you should use "-N "
fi
====================================================================== 

---------------------------------------------------------------------- 
 svnbot - 06-19-08 11:19  
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 123909

U   branches/1.4/build_tools/strip_nonapi

------------------------------------------------------------------------
r123909 | tilghman | 2008-06-19 11:19:04 -0500 (Thu, 19 Jun 2008) | 5
lines

Only process 40 arguments (20 files) at once with xargs, because some
older
shells may force xargs to separate on an odd boundary.
(Closes issue http://bugs.digium.com/view.php?id=12883)
Reported by Nik Soggia

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

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

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-19-08 11:19  svnbot         Checkin                                      
06-19-08 11:19  svnbot         Note Added: 0088935                          
06-19-08 11:19  svnbot         Status                   new => resolved     
06-19-08 11:19  svnbot         Resolution               open => fixed       
06-19-08 11:19  svnbot         Assigned To               => svnbot          
======================================================================




More information about the asterisk-bugs mailing list