[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 03:51:03 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=12883 
====================================================================== 
Reported By:                Nik Soggia
Assigned To:                
====================================================================== 
Project:                    Asterisk
Issue ID:                   12883
Category:                   General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
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:              
====================================================================== 
Date Submitted:             06-18-2008 11:00 CDT
Last Modified:              06-19-2008 03:51 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
====================================================================== 

---------------------------------------------------------------------- 
 Nik Soggia - 06-19-08 03:51  
---------------------------------------------------------------------- 
It will surely solve the problem, and it works on solaris too.

My xargs decided that the maximum command line lenght (including "echo
strip asterisk") was 1024 bytes and split the work in four: 67, 63, 63, 51
symbols each run (asterisk 1.4.21).
To be on the safe side, the even number should be 40 or less. Strip would
run 7 times, still much less than 244 times.

I was just looking if it was possible to preserve the ability of modern
system with large limits on command line length to strip the unneeded
symbols in just one go. But the very little speed gain of a single script
run once at the end of the build is far less important than portability,
and the long option of my workaround works only with GNU xargs. 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
06-19-08 03:51  Nik Soggia     Note Added: 0088898                          
======================================================================




More information about the asterisk-bugs mailing list