bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: POSIXLY_CORRECT not correctly unset in getopt.m4?


From: Paolo Bonzini
Subject: Re: POSIXLY_CORRECT not correctly unset in getopt.m4?
Date: Wed, 08 Sep 2010 11:56:49 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.10) Gecko/20100621 Fedora/3.0.5-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.0.5

On 09/08/2010 11:30 AM, Bruno Haible wrote:
[removing bug-standards from the CC list]

Paolo Bonzini wrote:
On 09/07/2010 10:39 PM, Eric Blake wrote:
         gl_awk_probe='BEGIN { for (v in ENVIRON)
           if (v == "POSIXLY_CORRECT") print "x" }'
         case ${POSIXLY_CORRECT:+x}`awk "$gl_awk_probe"</dev/null` in
           xx) gl_had_POSIXLY_CORRECT=exported ;;
           x)  gl_had_POSIXLY_CORRECT=yes      ;;
           *)  gl_had_POSIXLY_CORRECT=         ;;
         esac

Walking all of ENVIRON seems slow.

But it handles an empty exported value correctly:
   export POSIXLY_CORRECT=
has the same semantics as
   export POSIXLY_CORRECT=1

So maybe it should be ${POSIXLY_CORRECT+x}, not ${POSIXLY_CORRECT:+x}? Right now it's inconsistent.

bash seems to confirm this

    $ POSIXLY_CORRECT=
    $ set -o | grep posix
    posix               on
    $ echo ${POSIXLY_CORRECT:+yes}

    $ echo ${POSIXLY_CORRECT+yes}
    yes

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]