[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 14/16] qemu-img: Improve error messages
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PULL 14/16] qemu-img: Improve error messages |
Date: |
Fri, 25 Apr 2014 22:21:52 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) |
Jeff Cody <address@hidden> writes:
> On Wed, Apr 23, 2014 at 12:04:49PM +0200, Kevin Wolf wrote:
>> From: Fam Zheng <address@hidden>
>>
>> Previously, when there is a user error in argv parsing, qemu-img prints
>> help text and exits.
>>
>> Add an error_exit function to print a helpful error message and a hint
>> to run 'qemu-img --help' for more information.
>>
>> As a bonus, "qemu-img <cmd> --help" now has a more reasonable exit code
>> 0.
>>
>> In the future the help text should be split by sub command, and only
>> print the information for the specified command.
>>
>> Signed-off-by: Fam Zheng <address@hidden>
>> Signed-off-by: Kevin Wolf <address@hidden>
>> ---
>
> This breaks 'qemu-img --help':
>
> ./qemu-img --help
> qemu-img: Command not found: --help
> Try 'qemu-img --help' for more information
>
> See below:
>
>
> <snip>
>
>> bs = bdrv_new_open("image", filename, fmt,
>> @@ -2781,8 +2799,9 @@ int main(int argc, char **argv)
>>
>> qemu_init_main_loop();
>> bdrv_init();
>> - if (argc < 2)
>> - help();
>> + if (argc < 2) {
>> + error_exit("Not enough arguments");
>> + }
>
> As an aside, are we sure we want './qemu-img' with no arguments to not
> return the full help message?
I hate it when programs spew out screenfulls of help on incorrect usage.
Three lines are the limit for me: error message, brief help, how to get
full help.
[...]
- [Qemu-devel] [PULL 05/16] vmdk: Fix %d and %lld to PRI* in format strings, (continued)
- [Qemu-devel] [PULL 05/16] vmdk: Fix %d and %lld to PRI* in format strings, Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 02/16] block: Limit size to INT_MAX in bdrv_check_byte_request(), Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 01/16] block: Fix nb_sectors check in bdrv_check_byte_request(), Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 07/16] curl: Replaced old error handling with error reporting API., Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 11/16] qemu-img: Avoid duplicate block device IDs, Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 13/16] qemu-iotests: Check common namespace for id and node-name, Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 10/16] block: Add errp to bdrv_new(), Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 12/16] block: Catch duplicate IDs in bdrv_new(), Kevin Wolf, 2014/04/23
- [Qemu-devel] [PULL 14/16] qemu-img: Improve error messages, Kevin Wolf, 2014/04/23
[Qemu-devel] [PULL 09/16] convert fprintf() calls to error_setg() in block/qed.c:bdrv_qed_create(), Kevin Wolf, 2014/04/23
[Qemu-devel] [PULL 08/16] block: Remove -errno return value from bdrv_assign_node_name, Kevin Wolf, 2014/04/23
[Qemu-devel] [PULL 15/16] vmdk: Fix "%x" to PRIx32 in format strings for cid, Kevin Wolf, 2014/04/23
[Qemu-devel] [PULL 16/16] block/cloop: use PRIu32 format specifier for uint32_t, Kevin Wolf, 2014/04/23
[Qemu-devel] [PULL 06/16] block: Handle error of bdrv_getlength in bdrv_create_dirty_bitmap, Kevin Wolf, 2014/04/23
Re: [Qemu-devel] [PULL 00/16] Block patches, Peter Maydell, 2014/04/25