[libvirt] [PATCH 4/8] tests: don't alter state in $HOME
Paolo Bonzini
pbonzini at redhat.com
Tue Mar 29 10:04:01 UTC 2011
On 03/28/2011 06:02 PM, Eric Blake wrote:
> On 03/27/2011 02:59 AM, Laine Stump wrote:
>> On 03/26/2011 08:12 AM, Eric Blake wrote:
>>> Diego reported a bug where virsh tries to initialize a readline
>>> history directory during 'make check' run as root, but fails
>>> because /root was read-only.
>>>
>>> It turns out that I could reproduce this as non-root, by using:
>>>
>>> mv ~/.virsh{,.bak}
>>> chmod a-w ~
>>> make check -C tests TESTS=int-overflow
>>> chmod u+w ~
>>> mv ~/.virsh{.bak,}
>>>
>>> * tests/int-overflow: Don't trigger interactive mode.
>>> Reported by Diego Elio Pettenò.
>>> ---
>>>
>>>
>>> echo "error: failed to get domain '4294967298'"> exp || fail=1
>>> -echo domname 4294967298 | $abs_top_builddir/tools/virsh --quiet \
>>> +$abs_top_builddir/tools/virsh --quiet \
>>> --connect test://$abs_top_srcdir/examples/xml/test/testnode.xml \
>>> -> /dev/null 2> err || fail=1
>>> + 'domname 4294967298; quit'> /dev/null 2> err || fail=1
>>> diff -u err exp || fail=1
>>
>> Why the "; quit" in the command? a quit is implicit anyway.
>
> A quit may be implicit, but the problem at hand is what $? gets set to
> in the shell after virsh is done. In batch mode, virsh exits with the
> status of the last command executed, and we expect the domname command
> to fail (invalid argument), whereas quit (trivially) succeeds. That is,
> since the shell script expects $? to be zero, the quit command is
> necessary to avoid polluting the exit status with the failure from
> domname while still proving that virsh didn't abort command processing
> merely because one command failed. We didn't need the quit in
> interactive mode, because EOF is treated the same as an implicit quit
> command.
>
>>
>> ACK, with or without the quit - it works either way.
>
> Pushed with the quit.
What about, on top of this, something like the attached (untested,
uncompiled :)) patch? It enables readline only when stdin is a TTY, and
MinGW already has isatty.
Paolo
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: readline.patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110329/9d964dfd/attachment-0001.ksh>
More information about the libvir-list
mailing list