List Info

Thread: uname and /




uname and /
user name
2007-02-25 15:35:03
[rafaelprofane threadperl]$ ./perl -Ilib -V:myuname
myuname='freebsd profane.mongueurs.net 6.0-stable freebsd
6.0-stable
#5: fri feb 24 11:12:56 cet 2006
rootprofane.mongueurs.net:usrobjusrsrcsysprofane i386 ';
[rafaelprofane threadperl]$ uname -a
FreeBSD profane.mongueurs.net 6.0-STABLE FreeBSD 6.0-STABLE
#5: Fri
Feb 24 11:12:56 CET 2006
rootprofane.mongueurs.net:/usr/obj/usr/src/sys/PROFANE 
i386

Just being curious, why does Configure remove slashes from
the output
of uname -a ?
That happens on line 3005 :

myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's////g'
| 
        ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`

Re: uname and /
user name
2007-02-26 04:40:22
Rafael Garcia-Suarez wrote:
> On 26/02/07, Sam Vilain <samvilain.net> wrote:
>> That particular line was added between 5a9 and 5.0;
'git-annotate' on
>> Configure told me that much[1].  Looking at the
patch-ified version of
>> that change[2], I spotted these lines that were
added to this mysterious
>> file "U/Oldconfig.U", which was removed
by 5.0;
>
> Those files are now maintained in a separate branch,
> //depot/metaconfig. But that line hasn't changed since
the first
> import, change #3736.

Ok here we go:

http://git.catalyst.n
et.nz/gitweb2?p=perl.git;a=blob;f=U/Oldconfig.U;h=18c2a811;h
b=852b8daa

  54 ?X: indentation wrong on purpose--RAM
  55 ?X: Leave a white space between first two '(' for ksh.
The
sub-shell is needed
  56 ?X: on some machines to avoid the error message when
uname is not
found; e.g.
  57 ?X: old SUN-OS 3.2 would not execute hostname in (uname
-a ||
hostname). Sigh!
  58 myuname=`( ($uname -a) 2>/dev/null || hostname)
2>&1`
  59 ?X: Special mention for Xenix, whose 'uname -a' gives
us output
like this:
  60 ?X:  sysname=XENIX
  61 ?X:  nodename=whatever
  62 ?X:  release=2.3.2 .. etc...
  63 ?X: Therefore, we strip all this variable assignment
junk and
remove all the
  64 ?X: new lines to keep the myuname variable sane...
--RAM
  65 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | 
  66         tr '[A-Z]' '[a-z]' | tr '12' ' '`

See also the message at the top of that file.  But that's
all not really
asking your main question as to why the s////g appeared in
5.0.  We'd
need the lost p5p archives from that era to reconstruct
this.

and cg-admin-rewritehist just ate all my commit timestamps. 
grr..

Sam.

Re: uname and /
user name
2007-02-26 09:44:53
On Mon, 26 Feb 2007, Sam Vilain wrote:

> Rafael Garcia-Suarez wrote:
> > [rafaelprofane threadperl]$ ./perl -Ilib
-V:myuname
> > myuname='freebsd profane.mongueurs.net 6.0-stable
freebsd 6.0-stable
> > #5: fri feb 24 11:12:56 cet 2006
> > rootprofane.mongueurs.net:usrobjusrsrcsysprofane i386 ';
> > [rafaelprofane threadperl]$ uname -a
> > FreeBSD profane.mongueurs.net 6.0-STABLE FreeBSD
6.0-STABLE #5: Fri
> > Feb 24 11:12:56 CET 2006
> > rootprofane.mongueurs.net:/usr/obj/usr/src/sys/PROFANE 
i386
> >
> > Just being curious, why does Configure remove
slashes from the output
> > of uname -a ?

Paranoia, I expect.  The only real purpose of the 'myuname'
variable is to 
test whether an existing config.sh was built on the same
system as the one 
currently running Configure.  The variable has to be safe to
use 
as an argument for various shell built-in commands and safe
to pass as a 
pattern to 'grep'.

Offhand, I don't see any reason to remove the slashes.

> > That happens on line 3005 :
> >
> > myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e
's////g' | 
> >        ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`

> That particular line was added between 5a9 and 5.0;
'git-annotate' on
> Configure told me that much[1].  Looking at the
patch-ified version of
> that change[2], I spotted these lines that were added
to this mysterious
> file "U/Oldconfig.U", which was removed by
5.0;

That line comes from the 'dist' package, which is used to
generate 
Configure.  That particular line came in patch16 to dist-3.0
(dated 
1994/01/24).  I merged dist-3.0 into perl5 shortly after
perl5alpha7, so 
that's probably when it would show up in the perl archives.

> +?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
> +myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | 
> +       tr '[A-Z]' '[a-z]' | tr '12' ' '`

> Coincidentally this is the period of history that Andy
pointed out there
> are those extra revisions for; I'll graft them in and
see if there's
> anything more useful there.

I suspect you won't find anything useful there.  The RCS log
is in the 
Oldconfig.U unit in the metaconfig branch in the perforce
repository, 
(which is where I got the patch16 reference) but it doesn't
tell you 
anything more.

-- 
    Andy Dougherty		dougheralafayette.edu

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )