On 03/14/2012 12:57 PM, Stefan Weil wrote:
> qemu-img requires first options, then file name, then size.
> 
> GNU getopt also allows options at the end, but POSIX getopt
> doesn't. Try "export POSIXLY_CORRECT=y" to get the POSIX
> behaviour with GNU getopt, too.

That's a heavy sledgehammer, that has the potential to affect a lot of
other programs called alongside qemu-img.  Simpler would be to just pass
-- in the command line at the point where you want to force qemu to
treat all further arguments without getopt reordering them, as in:

>      # XXX(hch): have global image options?
> -    $QEMU_IMG create -f $IMGFMT $TEST_IMG $extra_img_options | \
> +    $QEMU_IMG create -f $IMGFMT $extra_img_options $TEST_IMG $image_size | \

$QEMU_IMG -- create -f $IMGFMT $extra_img_options $TEST_IMG $image_size

-- 
Eric Blake   ebl...@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to