qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: Stop using "which" in ./configure


From: Måns Rullgård
Subject: [Qemu-devel] Re: Stop using "which" in ./configure
Date: Wed, 20 Jan 2010 18:11:21 +0000
User-agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (Instant Classic, linux)

Loïc Minier <address@hidden> writes:

> On Wed, Jan 20, 2010, Paolo Bonzini wrote:
>> >  Are you saying that I can't backup/restore IFS without setting it
>> >  first?
>> Yes, it affects the behavior of read for example:
>> $ echo a b c | (read a b c; echo $a; echo $b; echo $c)
>> a
>> b
>> c
>> $ IFS=
>> $ echo a b c | (read a b c; echo $a; echo $b; echo $c)
>> a b c
>> 
>> $
>> (It's not used by QEMU's configure, but it's better to be defensive).
>
>  I *do* understand that changing IFS will affect the program, but the
>  patch I sent will backup IFS and then restore it; perhaps you missed
>  the backup/restore bits:

It might not be set at all to begin with, in which case you'd set it
the empty string when restoring, and that would change the behaviour.

The POSIX spec says this:

  If IFS is not set, the shell shall behave as if the value of IFS is
  <space>, <tab>, and <newline>

>  +    local_ifs="$IFS"
>  [...]
>  +    IFS=:
>  [...]
>  +            IFS="$local_ifs"
>  +            return 0
>  [...]
>  +    IFS="$local_ifs"
>  +    return 1

If you make that IFS=${local_ifs:-$(printf ' \t\n')} it should be safe.
Likewise if you set the value first.

-- 
Måns Rullgård
address@hidden





reply via email to

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