Skip Menu |
 
Report information
Id: 116523
Status: resolved
Priority: 0/
Queue: perl5

Owner: doughera <doughera [at] lafayette.edu>
Requestors: apb [at] cequrux.com
Cc:
AdminCc:

Operating System: netbsd
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.14.2
Fixed In: (no value)



Subject: Configure is confused by '=' in output from uname -a
Date: Wed, 23 Jan 2013 13:04:02 +0000 (UTC)
To: perlbug [...] perl.org
From: apb [...] cequrux.com
Download (untitled) / with headers
text/plain 5.6k
This is a bug report for perl from apb@cequrux.com, generated with the help of perlbug 1.39 running under perl 5.14.2. ----------------------------------------------------------------- [Please describe your issue here] The Configure script that comes with perl-5-16.2 (and probably other versions) attempts to parse the output from "uname -a" to get the operating system name and version. This can easily go wrong. This code in the Configure script ignores everything up to and including the first '=' sign: 3098 myuname=`$uname -a 2>/dev/null` 3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null` 3100 # tr '[A-Z]' '[a-z]' would not work in EBCDIC 3101 # because the A-Z/a-z are not consecutive. 3102 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \ 3103 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` I assume that there is some system where this is useful, but in my case it causes incorrect results. "uname -a" produces output like this (all on one long line, but wrapped for readability here): NetBSD hostname.domainname 6.99.16 NetBSD 6.99.16 (MYKERNEL) #1: Sun Jan 20 21:29:01 UTC 2013 username@hostname.domainname:/dirname/compile/MYKERNEL cvs root=username@hostname:/dirname module=src branch=HEAD After the sed and tr commands in lines 3102 and 3103, we are left with the following value in myuname: username@hostname:/dirname module=src branch=HEAD There's no operating system name or version there, so the Configure script fails to detect that it's running on NetBSD, and this causes it to fail to apply the settings from the hints/netbsd.sh file. This in turn leads to a build failure whose details are not important here. I don't why it tries to parse the OS name and version from "uname -a" instead of using "uname -s" and "uname -r", and I don't know what systems have a "uname -a" such that ignoring everything up to the first '=' sign is useful. I would suggest using "uname -s" and "uname -r" instead of "uname -a", but that's a large change. A very small change that works for me is this: --- Configure.orig 2012-10-26 02:44:14.000000000 +0000 +++ Configure @@ -3099,7 +3099,7 @@ myuname=`$uname -a 2>/dev/null` $test -z "$myuname" && myuname=`hostname 2>/dev/null` # tr '[A-Z]' '[a-z]' would not work in EBCDIC # because the A-Z/a-z are not consecutive. -myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \ +myuname=`echo $myuname | $sed -e 's/^[^= ]*=//' -e "s,['/],,g" | \ ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` newmyuname="$myuname" dflt=n This will still delete eveything up to and including the first '=' (in case this is needed on some other system), but it will do so only if there is no space between the beginning of the line and the '=' (so it does not get confused on my system). [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.14.2: Configured by apb at Mon Sep 17 19:53:17 SAST 2012. Summary of my perl5 (revision 5 version 14 subversion 2) configuration: Platform: osname=netbsd, osvers=6.99.11, archname=i386-netbsd-thread-multi uname='netbsd hostname.domainname 6.99.11 netbsd 6.99.11 (kernelconfig) #1: sat sep 15 16:16:03 utc 2012 username@hostname.domainname:dirname i386 ' config_args='-sde -D ccflags=-O2 -pthread -I/usr/include -D ldflags= -pthread -L/usr/lib -Wl,-R/usr/lib -Wl,-R/usr/pkg/lib -Duseshrplib -Duseithreads -Uusemymalloc' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-O2 -pthread -I/usr/include -fno-strict-aliasing -pipe -fstack-protector -I/usr/pkg/include', optimize='-O2 -pthread -I/usr/include', cppflags='-O2 -pthread -I/usr/include -fno-strict-aliasing -pipe -fstack-protector -I/usr/pkg/include' ccversion='', gccversion='4.5.3', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags ='-Wl,-R/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib -fstack-protector -L/usr/pkg/lib' libpth=/lib /usr/lib /usr/pkg/lib libs=-lm -lcrypt -lpthread perllibs=-lm -lcrypt -lpthread libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-R/usr/pkg/lib/perl5/5.14.0/i386-netbsd-thread-multi/CORE' cccdlflags='-DPIC -fPIC ', lddlflags='-Wl,-R/usr/pkg/lib --whole-archive -shared -L/usr/pkg/lib -fstack-protector' Locally applied patches: --- @INC for perl 5.14.2: /usr/pkg/lib/perl5/site_perl/5.14.0/i386-netbsd-thread-multi /usr/pkg/lib/perl5/site_perl/5.14.0 /usr/pkg/lib/perl5/vendor_perl/5.14.0/i386-netbsd-thread-multi /usr/pkg/lib/perl5/vendor_perl/5.14.0 /usr/pkg/lib/perl5/5.14.0/i386-netbsd-thread-multi /usr/pkg/lib/perl5/5.14.0 . --- Environment for perl 5.14.2: HOME=/home/apb LANG=C LANGUAGE (unset) LC_ALL= LC_CTYPE=C LC_MESSAGES=C LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/apb/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/pkg/bin:/usr/pkg/sbin:/usr/X11R7/bin:/usr/local/bin:/usr/local/sbin PERL_BADLANG (unset) SHELL=/usr/pkg/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 3.2k
On Wed Jan 23 05:04:38 2013, apb@cequrux.com wrote: Show quoted text
> This is a bug report for perl from apb@cequrux.com, > generated with the help of perlbug 1.39 running under perl 5.14.2. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > The Configure script that comes with perl-5-16.2 (and probably > other versions) attempts to parse the output from "uname -a" > to get the operating system name and version. This can easily > go wrong. > > This code in the Configure script ignores everything up to and > including the first '=' sign: > > 3098 myuname=`$uname -a 2>/dev/null` > 3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null` > 3100 # tr '[A-Z]' '[a-z]' would not work in EBCDIC > 3101 # because the A-Z/a-z are not consecutive. > 3102 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" > | \ > 3103 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` > > I assume that there is some system where this is useful, but > in my case it causes incorrect results. "uname -a" produces > output like this (all on one long line, but wrapped for > readability here): > > NetBSD hostname.domainname 6.99.16 NetBSD 6.99.16 (MYKERNEL) > #1: Sun Jan 20 21:29:01 UTC 2013 > username@hostname.domainname:/dirname/compile/MYKERNEL > cvs root=username@hostname:/dirname module=src branch=HEAD > > After the sed and tr commands in lines 3102 and 3103, we are left with > the following value in myuname: > > username@hostname:/dirname module=src branch=HEAD > > There's no operating system name or version there, so > the Configure script fails to detect that it's running on > NetBSD, and this causes it to fail to apply the settings from > the hints/netbsd.sh file. This in turn leads to a build failure > whose details are not important here. > > I don't why it tries to parse the OS name and version from > "uname -a" instead of using "uname -s" and "uname -r", and I > don't know what systems have a "uname -a" such that ignoring > everything up to the first '=' sign is useful. > > I would suggest using "uname -s" and "uname -r" instead of > "uname -a", but that's a large change. A very small change > that works for me is this: > > --- Configure.orig 2012-10-26 02:44:14.000000000 +0000 > +++ Configure > @@ -3099,7 +3099,7 @@ myuname=`$uname -a 2>/dev/null` > $test -z "$myuname" && myuname=`hostname 2>/dev/null` > # tr '[A-Z]' '[a-z]' would not work in EBCDIC > # because the A-Z/a-z are not consecutive. > -myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \ > +myuname=`echo $myuname | $sed -e 's/^[^= ]*=//' -e "s,['/],,g" | \ > ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` > newmyuname="$myuname" > dflt=n > > This will still delete eveything up to and including the first > '=' (in case this is needed on some other system), but it will > do so only if there is no space between the beginning of the > line and the '=' (so it does not get confused on my system). >
FWIW I tried this patch out on a recent Darwin/x86_64 (OS X 10.6, I believe) and it had no negative impact on 'make' or 'make test'. We should probably get this tried out on lots of OSes, as well as having our Configure maintainers chime in. Thank you very much. Jim Keenan
Subject: Re: [perl #116523] Configure is confused by '=' in output from uname -a
Date: Thu, 24 Jan 2013 09:06:58 -0500 (EST)
To: Perl Porters <perl5-porters [...] perl.org>
From: Andy Dougherty <doughera [...] lafayette.edu>
Download (untitled) / with headers
text/plain 2.1k
On Wed, 23 Jan 2013, apb @ cequrux . com wrote: Show quoted text
> This code in the Configure script ignores everything up to and > including the first '=' sign: > > 3098 myuname=`$uname -a 2>/dev/null` > 3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null` > 3100 # tr '[A-Z]' '[a-z]' would not work in EBCDIC > 3101 # because the A-Z/a-z are not consecutive. > 3102 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \ > 3103 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` > > I assume that there is some system where this is useful, but > in my case it causes incorrect results. "uname -a" produces > output like this (all on one long line, but wrapped for > readability here): > > NetBSD hostname.domainname 6.99.16 NetBSD 6.99.16 (MYKERNEL) > #1: Sun Jan 20 21:29:01 UTC 2013 > username@hostname.domainname:/dirname/compile/MYKERNEL > cvs root=username@hostname:/dirname module=src branch=HEAD > > After the sed and tr commands in lines 3102 and 3103, we are left with > the following value in myuname: > > username@hostname:/dirname module=src branch=HEAD
That snippet of Configure was designed to handle the uname output on Xenix. The metaconfig unit contains these additional comments about it: ?X: Special mention for Xenix, whose 'uname -a' gives us output like this: ?X: sysname=XENIX ?X: nodename=whatever ?X: release=2.3.2 .. etc... ?X: Therefore, we strip all this variable assignment junk and remove all the ?X: new lines to keep the myuname variable sane... --RAM I think it's probably safe to drop Xenix support from perl 5. Practically, that means removing the entire sed command. Show quoted text
> I would suggest using "uname -s" and "uname -r" instead of > "uname -a", but that's a large change. A very small change > that works for me is this:
At the time, my recollection is that we couldn't even count on "uname" being available, let alone relying on specific options to give meaningful results. Now, however, you're probably right. Still, for the moment, the smaller change of removing the sed command is probably the safer way to go. -- Andy Dougherty doughera@lafayette.edu
Subject: Re: [perl #116523] Configure is confused by '=' in output from uname -a
Date: Thu, 24 Jan 2013 15:48:07 +0100
To: perl5-porters [...] perl.org
From: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
Download (untitled) / with headers
text/plain 2.8k
On Thu, 24 Jan 2013 09:06:58 -0500 (EST), Andy Dougherty <doughera@lafayette.edu> wrote: Show quoted text
> On Wed, 23 Jan 2013, apb @ cequrux . com wrote: >
> > This code in the Configure script ignores everything up to and > > including the first '=' sign: > > > > 3098 myuname=`$uname -a 2>/dev/null` > > 3099 $test -z "$myuname" && myuname=`hostname 2>/dev/null` > > 3100 # tr '[A-Z]' '[a-z]' would not work in EBCDIC > > 3101 # because the A-Z/a-z are not consecutive. > > 3102 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e "s,['/],,g" | \ > > 3103 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '` > > > > I assume that there is some system where this is useful, but > > in my case it causes incorrect results. "uname -a" produces > > output like this (all on one long line, but wrapped for > > readability here): > > > > NetBSD hostname.domainname 6.99.16 NetBSD 6.99.16 (MYKERNEL) > > #1: Sun Jan 20 21:29:01 UTC 2013 > > username@hostname.domainname:/dirname/compile/MYKERNEL > > cvs root=username@hostname:/dirname module=src branch=HEAD > > > > After the sed and tr commands in lines 3102 and 3103, we are left with > > the following value in myuname: > > > > username@hostname:/dirname module=src branch=HEAD
> > That snippet of Configure was designed to handle the uname output on > Xenix. The metaconfig unit contains these additional comments about it: > > ?X: Special mention for Xenix, whose 'uname -a' gives us output like this: > ?X: sysname=XENIX > ?X: nodename=whatever > ?X: release=2.3.2 .. etc... > ?X: Therefore, we strip all this variable assignment junk and remove all the > ?X: new lines to keep the myuname variable sane... --RAM > > I think it's probably safe to drop Xenix support from perl 5. > Practically, that means removing the entire sed command. >
> > I would suggest using "uname -s" and "uname -r" instead of > > "uname -a", but that's a large change. A very small change > > that works for me is this:
> > At the time, my recollection is that we couldn't even count on "uname" > being available, let alone relying on specific options to give meaningful > results. Now, however, you're probably right.
uname -s is pretty reliable, but I have no idea if uname -r will be useful at all (see AIX) uname -s uname -r ------------ ------------ ------------------------------- Linux Linux 3.4.11-2.16-desktop HP-UX 10.20 HP-UX B.10.20 HP-UX 11.31 HP-UX B.11.31 AIX 5.3.0.0 AIX 3 Show quoted text
> Still, for the moment, the smaller change of removing the sed command > is probably the safer way to go.
Agree -- H.Merijn Brand http://tux.nl Perl Monger http://amsterdam.pm.org/ using perl5.00307 .. 5.17 porting perl5 on HP-UX, AIX, and openSUSE http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/
CC: Perl Porters <perl5-porters [...] perl.org>
Subject: Re: [perl #116523] Configure is confused by '=' in output from uname -a
Date: Tue, 19 Feb 2013 09:47:48 -0500 (EST)
To: "H.Merijn Brand" <h.m.brand [...] xs4all.nl>
From: Andy Dougherty <doughera [...] lafayette.edu>
Download (untitled) / with headers
text/plain 239b
I removed the Xenix support in metaconfig commit 05a827803ab3908a795df94f6ed3890e24a6df2, and applied the corresponding patch to blead with commit f4dc174a8581e2dba27554879e2ae596e9139da3 . -- Andy Dougherty doughera@lafayette.edu


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org