Re: Unportable use of uname in pg_upgrade test script - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Unportable use of uname in pg_upgrade test script
Date
Msg-id 506730FD.4010605@dunslane.net
Whole thread Raw
In response to Re: Unportable use of uname in pg_upgrade test script  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Unportable use of uname in pg_upgrade test script  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Unportable use of uname in pg_upgrade test script  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On 09/29/2012 01:06 PM, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> The trouble with uname -s is that its output is a bit variable. I think
>> this will work:
>>       testhost=`uname -a | sed 's/.* //'`
> What do you mean by "a bit variable"?

On one of my machines uname -s return MINGW32_NT5.1

On another it says MINGW32_NT6.1




> And why would that fix it?  The
> output of -a is *defined* to be the same as -s followed by other stuff.
> The reference page I'm looking at also points out that the -s string
> can contain embedded blanks.

Exactly, the sed script pulls the last token from the line, which is 
Msys on all my Mingw systems.

If you want to do it another way we could possibly pass the PORTNAME 
from the global make file.

cheers

andrew




pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unportable use of uname in pg_upgrade test script
Next
From: Tom Lane
Date:
Subject: Re: Unportable use of uname in pg_upgrade test script