Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure is confused by '=' in output from uname -a #12734

Closed
p5pRT opened this issue Jan 23, 2013 · 7 comments
Closed

Configure is confused by '=' in output from uname -a #12734

p5pRT opened this issue Jan 23, 2013 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jan 23, 2013

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

Searchable as RT116523$

@p5pRT
Copy link
Author

p5pRT commented Jan 23, 2013

From apb@cequrux.com

Created by apb@cequrux.com

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

Perl Info

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

@p5pRT
Copy link
Author

p5pRT commented Jan 23, 2013

From @jkeenan

On Wed Jan 23 05​:04​:38 2013, apb@​cequrux.com wrote​:

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

@p5pRT
Copy link
Author

p5pRT commented Jan 23, 2013

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jan 24, 2013

From @doughera88

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.

Still, for the moment, the smaller change of removing the sed command
is probably the safer way to go.

--
  Andy Dougherty doughera@​lafayette.edu

@p5pRT
Copy link
Author

p5pRT commented Jan 24, 2013

From @Tux

On Thu, 24 Jan 2013 09​:06​:58 -0500 (EST), Andy Dougherty
<doughera@​lafayette.edu> wrote​:

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&#8203;: Sun Jan 20 21&#8203;:29&#8203;:01 UTC 2013
 username@&#8203;hostname\.domainname&#8203;:/dirname/compile/MYKERNEL 
 cvs root=username@&#8203;hostname&#8203;:/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@&#8203;hostname&#8203;:/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

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/

@p5pRT
Copy link
Author

p5pRT commented Feb 19, 2013

From @doughera88

I removed the Xenix support in metaconfig commit
05a827803ab3908a795df94f6ed3890e24a6df2, and applied the corresponding
patch to blead with commit f4dc174 .

--
  Andy Dougherty doughera@​lafayette.edu

@p5pRT
Copy link
Author

p5pRT commented Feb 19, 2013

@doughera88 - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant