Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.86k stars 528 forks source link

[PATCH 5.5.660] $@ unsafe in Configure sed arguments #1218

Closed p5pRT closed 20 years ago

p5pRT commented 24 years ago

Migrated from rt.perl.org#2202 (status was 'resolved')

Searchable as RT2202$

p5pRT commented 24 years ago

From domo@computer.org

Created by domo@computer.org

This has been going on a while\, but\, as it didn't actually stop me from building perl\, I've been remiss about submitting a patch. Anyway...

In a number of cases\, Configure uses '@​' as a delimiter in arguments to sed. When this is is preceded by '$' (match at end of line)\, the resulting '$@​' sometimes seems to get expanded by some shell or another. One symptom is 'sed​: Unterminated `s' command'. (This is GNU sed version 2.05\, but I think this is a shell quoting problem -- probably an implementation-specific one\, not a sed problem.)

As shell quoting problems are hell to trace\, I'm simply attaching a patch which substitutes '%' for '@​' as a delimiter. Works for me. Don't think it will screw things up for anybody else.

Oh\, yes​: some test problems for MachTen and 5.5.660. Report to follow.

Inline Patch ```diff --- perl5.5.660/Configure-as-received Tue Feb 22 10:19:52 2000 +++ perl5.5.660/Configure Wed Feb 23 17:18:52 2000 @@ -2403,12 +2403,12 @@ : specified already. case "$hintfile" in ''|' ') - file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` + file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'` : Also try without trailing minor version numbers. - xfile=`echo $file | $sed -e 's@_[^_]*$@@'` - xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` - xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` - xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` + xfile=`echo $file | $sed -e 's%_[^_]*$%%'` + xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'` + xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'` + xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'` case "$file" in '') dflt=none ;; *) case "$osvers" in @@ -3743,7 +3743,7 @@ libsfound="$libsfound $xxx" yyy=`basename $xxx` libsfiles="$libsfiles $yyy" - yyy=`echo $xxx|sed "s@/$yyy\\$@@"` + yyy=`echo $xxx|sed "s%/$yyy\\$%%"` case " $libsdirs " in *" $yyy "*) ;; *) libsdirs="$libsdirs $yyy" ;; @@ -5958,7 +5958,7 @@ . ./getfile usedl="$define" : emulate basename - dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` + dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'` $cat << EOM ```
Perl Info ``` Site configuration information for perl v5.5.660: Configured by domo at Wed Feb 23 17:22:21 WET 2000. Summary of my perl5 (revision 5.0 version 5 subversion 660) configuration: Platform: osname=machten, osvers=4.1.4, archname=powerpc-machten uname='machten ppp100 5 0.5 powerpc ' config_args='-Doptimize=-g -de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usesocks=undef useperlio=undef d_sfio=undef use64bits=undef uselargefiles=define usemultiplicity=undef Compiler: cc='cc', optimize='-g', gccversion=2.8.1 cppflags='-DNOTDEF_MACHTEN -DREG_INFTY=2047 -DDEBUGGING -I/usr/local/include' ccflags ='-DNOTDEF_MACHTEN -DREG_INFTY=2047 -DDEBUGGING -I/usr/local/include' stdchar='char', d_stdstdio=undef, usevfork=true intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld', ldflags =' -Xlstack=1048576 -L/usr/local/lib' libpth=/usr/local/lib /usr/lib libs=-lndbm -lgdbm -ldb -lm -lc libc=/usr/lib/libc.a, so=so, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_none.xs, dlext=none, d_dlsymun=undef, ccdlflags='' cccdlflags='', lddlflags='' Locally applied patches: @INC for perl v5.5.660: lib /usr/local/lib/perl5/5.5.660/powerpc-machten /usr/local/lib/perl5/5.5.660 /usr/local/lib/perl5/site_perl/5.00557/powerpc-machten /usr/local/lib/perl5/site_perl/5.00557 /usr/local/lib/perl5/site_perl/5.00556/powerpc-machten /usr/local/lib/perl5/site_perl/5.00556 /usr/local/lib/perl5/site_perl . Environment for perl v5.5.660: HOME=/home/domo LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH=/usr/lib LOGDIR (unset) PATH=/sbin:/usr/sbin:/home/domo/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11/bin:/usr/libexec PERL_BADLANG (unset) SHELL=/bin/bash ```