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