develooper Front page | perl.perl5.porters | Postings from February 2000

[ID 20000223.007] [PATCH 5.5.660] $@ unsafe in Configure sedarguments

From:
Dominic Dunlop
Date:
February 23, 2000 11:43
Subject:
[ID 20000223.007] [PATCH 5.5.660] $@ unsafe in Configure sedarguments
Message ID:
v04220800b4d9e48c51bb@[212.24.193.51]
This is a bug report for perl from domo@computer.org,
generated with the help of perlbug 1.27 running under perl v5.5.660.

-----------------------------------------------------------------
[Please enter your report here]

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.

--- 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
 

[Please do not change anything below this line]
-----------------------------------------------------------------

---
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



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About