Skip to contentSkip to conversation

improved --version/--help tweaks

PATCH In review Eric Blake 3 participants 8 messages Aug 3, 2017 – Aug 8, 2017

lore
Share & tools
lore

Eric Blake

author
#0 lore raw

v3 cover improved --version/--help tweaks

Not sure if this should go through Kevin's block tree, Paolo's miscellaneous patches, or if I should just do a pull request myself (since patch 4 includes a change to qemu-nbd)

since v2: add R-b on 2-4; also sort 'qemu-img --help' create text

001/4:[0012] [FC] 'qemu-img: Sort sub-command names in --help' 002/4:[----] [--] 'qemu-io: Give more --version information' 003/4:[----] [--] 'qga: Give more --version information' 004/4:[----] [--] 'maint: Include bug-reporting info in --help output'

Eric Blake (4):
qemu-img: Sort sub-command names in --help
qemu-io: Give more --version information
qga: Give more --version information
maint: Include bug-reporting info in --help output

 include/qemu-common.h |  5 +++++
 vl.c                  |  4 +++-
 bsd-user/main.c       |  2 ++
 linux-user/main.c     |  4 +++-
 qemu-img.c            |  2 +-
 qemu-io.c             |  9 ++++++---
 qemu-nbd.c            |  2 +-
 qga/main.c            |  8 +++++---
 qemu-img-cmds.hx      | 21 ++++++++++++---------
 9 files changed, 38 insertions(+), 19 deletions(-)
Signature · 1 line
2.13.3
author
#1 lore raw

PATCH v3 1/4 qemu-img: Sort sub-command names in --help

'amend' and 'create' were not listed alphabetically; hoist them earlier. Separate the @end table block to make it easier to copy-and-paste the addition of future sub-commands.

---
v3: also sort 'create' [Kevin]

---
 qemu-img-cmds.hx | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
qemu-img-cmds.hx +12 -9
index 3763f13625..e6ebdbfee4 100644
@@ -9,6 +9,12 @@ STEXI
 @table @option
 ETEXI
 
+DEF("amend", img_amend,
+    "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cache] -o options filename")
+STEXI
+@item amend [--object @var{objectdef}] [--image-opts] [-p] [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
+ETEXI
+
 DEF("bench", img_bench,
     "bench [-c count] [-d depth] [-f fmt] [--flush-interval=flush_interval] [-n] [--no-drain] [-o offset] [--pattern=pattern] [-q] [-s buffer_size] [-S step_size] [-t cache] [-w] [-U] filename")
 STEXI
@@ -21,12 +27,6 @@ STEXI
 @item check [--object @var{objectdef}] [--image-opts] [-q] [-f @var{fmt}] [--output=@var{ofmt}] [-r [leaks | all]] [-T @var{src_cache}] [-U] @var{filename}
 ETEXI
 
-DEF("create", img_create,
-    "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
-STEXI
-@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}]
-ETEXI
-
 DEF("commit", img_commit,
     "commit [-q] [--object objectdef] [--image-opts] [-f fmt] [-t cache] [-b base] [-d] [-p] filename")
 STEXI
@@ -45,6 +45,12 @@ STEXI
 @item convert [--object @var{objectdef}] [--image-opts] [--target-image-opts] [-U] [-c] [-p] [-q] [-n] [-f @var{fmt}] [-t @var{cache}] [-T @var{src_cache}] [-O @var{output_fmt}] [-B @var{backing_file}] [-o @var{options}] [-s @var{snapshot_id_or_name}] [-l @var{snapshot_param}] [-S @var{sparse_size}] [-m @var{num_coroutines}] [-W] @var{filename} [@var{filename2} [...]] @var{output_filename}
 ETEXI
 
+DEF("create", img_create,
+    "create [-q] [--object objectdef] [-f fmt] [-b backing_file] [-F backing_fmt] [-u] [-o options] filename [size]")
+STEXI
+@item create [--object @var{objectdef}] [-q] [-f @var{fmt}] [-b @var{backing_file}] [-F @var{backing_fmt}] [-u] [-o @var{options}] @var{filename} [@var{size}]
+ETEXI
+
 DEF("dd", img_dd,
     "dd [--image-opts] [-U] [-f fmt] [-O output_fmt] [bs=block_size] [count=blocks] [skip=blocks] if=input of=output")
 STEXI
@@ -87,9 +93,6 @@ STEXI
 @item resize [--object @var{objectdef}] [--image-opts] [-q] @var{filename} [+ | -]@var{size}
 ETEXI
 
-DEF("amend", img_amend,
-    "amend [--object objectdef] [--image-opts] [-p] [-q] [-f fmt] [-t cache] -o options filename")
 STEXI
-@item amend [--object @var{objectdef}] [--image-opts] [-p] [-q] [-f @var{fmt}] [-t @var{cache}] -o @var{options} @var{filename}
 @end table
 ETEXI
Signature · 1 line
2.13.3
author
#2 lore raw

PATCH v3 2/4 qemu-io: Give more --version information

In reply to Eric Blake

Include the package version information (useful for detecting builds from git or downstream backports), and the copyright notice.

---
 qemu-io.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
qemu-io.c +3 -1
index 4cfa41c8f9..ec175630a6 100644
@@ -26,6 +26,7 @@
 #include "block/block_int.h"
 #include "trace/control.h"
 #include "crypto/init.h"
+#include "qemu-version.h"
 
 #define CMD_NOFILE_OK   0x01
 
@@ -522,7 +523,8 @@ int main(int argc, char **argv)
             trace_file = trace_opt_parse(optarg);
             break;
         case 'V':
-            printf("%s version %s\n", progname, QEMU_VERSION);
+            printf("%s version " QEMU_VERSION QEMU_PKGVERSION "\n"
+                   QEMU_COPYRIGHT "\n", progname);
             exit(0);
         case 'h':
             usage(progname);
Signature · 1 line
2.13.3
author
#3 lore raw

PATCH v3 3/4 qga: Give more --version information

In reply to Eric Blake

Include the package version information (useful for detecting builds from git or downstream backports), and the copyright notice.

---
 qga/main.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
qga/main.c +4 -2
index 1b381d0bf3..b64c7ac2a2 100644
@@ -29,6 +29,7 @@
 #include "qemu/help_option.h"
 #include "qemu/sockets.h"
 #include "qemu/systemd.h"
+#include "qemu-version.h"
 #ifdef _WIN32
 #include "qga/service-win32.h"
 #include "qga/vss-win32.h"
@@ -213,7 +214,8 @@ static void usage(const char *cmd)
 {
     printf(
 "Usage: %s [-m <method> -p <path>] [<options>]\n"
-"QEMU Guest Agent %s\n"
+"QEMU Guest Agent " QEMU_VERSION QEMU_PKGVERSION "\n"
+QEMU_COPYRIGHT "\n"
 "\n"
 "  -m, --method      transport method: one of unix-listen, virtio-serial,\n"
 "                    isa-serial, or vsock-listen (virtio-serial is the default)\n"
@@ -248,7 +250,7 @@ static void usage(const char *cmd)
 "  -h, --help        display this help and exit\n"
 "\n"
 "Report bugs to <[email protected]>\n"
-    , cmd, QEMU_VERSION, QGA_VIRTIO_PATH_DEFAULT, QGA_SERIAL_PATH_DEFAULT,
+    , cmd, QGA_VIRTIO_PATH_DEFAULT, QGA_SERIAL_PATH_DEFAULT,
     dfl_pathnames.pidfile,
 #ifdef CONFIG_FSFREEZE
     QGA_FSFREEZE_HOOK_DEFAULT,
Signature · 1 line
2.13.3
author
#4 lore raw

PATCH v3 4/4 maint: Include bug-reporting info in --help output

In reply to Eric Blake

These days, many programs are including a bug-reporting address, or better yet, a link to the project web site, at the tail of their --help output. However, we were not very consistent at doing so: only qemu-nbd and qemu-qa mentioned anything, with the latter pointing to an individual person instead of the project.

Add a new #define that sets up a uniform string, mentioning both bug reporting instructions and overall project details, and which a downstream vendor could tweak if they want bugs to go to a downstream database. Then use it in all of our binaries which have --help output.

The canned text intentionally references http:// instead of https://
because our https website currently causes certificate errors in some browsers. That can be tweaked later once we have resolved the web site issued.

---
v3: tweak subject line

---
 include/qemu-common.h | 5 +++++
 vl.c                  | 4 +++-
 bsd-user/main.c       | 2 ++
 linux-user/main.c     | 4 +++-
 qemu-img.c            | 2 +-
 qemu-io.c             | 5 +++--
 qemu-nbd.c            | 2 +-
 qga/main.c            | 2 +-
 8 files changed, 19 insertions(+), 7 deletions(-)
include/qemu-common.h +5 -0
index b5adbfa5e9..d29045631f 100644
@@ -22,6 +22,11 @@
 #define QEMU_COPYRIGHT "Copyright (c) 2003-2017 " \
     "Fabrice Bellard and the QEMU Project developers"
 
+/* Bug reporting information for --help arguments, About dialogs, etc */
+#define QEMU_BUGREPORTS \
+    "See <http://qemu.org/contribute/report-a-bug> for bug reports.\n" \
+    "More information on the QEMU project at <http://qemu.org>."
+
 /* main function, renamed */
 #if defined(CONFIG_COCOA)
 int qemu_main(int argc, char **argv, char **envp);
vl.c +3 -1
index 99fcfa0442..5ad2506ded 100644
@@ -1942,7 +1942,9 @@ static void help(int exitcode)
            "ctrl-alt-n      switch to virtual console 'n'\n"
            "ctrl-alt        toggle mouse and keyboard grab\n"
            "\n"
-           "When using -nographic, press 'ctrl-a h' to get some help.\n");
+           "When using -nographic, press 'ctrl-a h' to get some help.\n"
+           "\n"
+           QEMU_BUGREPORTS "\n");
 
     exit(exitcode);
 }
bsd-user/main.c +2 -0
index 501e16f675..4db10cb376 100644
@@ -686,6 +686,8 @@ static void usage(void)
            "    -E var1=val2 -E var2=val2 -U LD_PRELOAD -U LD_DEBUG\n"
            "Note that if you provide several changes to single variable\n"
            "last change will stay in effect.\n"
+           "\n"
+           QEMU_BUGREPORTS "\n"
            ,
            TARGET_NAME,
            interp_prefix,
linux-user/main.c +3 -1
index 2b38d39d87..7d6e481277 100644
@@ -4136,7 +4136,9 @@ static void usage(int exitcode)
            "    -E var1=val2,var2=val2 -U LD_PRELOAD,LD_DEBUG\n"
            "    QEMU_SET_ENV=var1=val2,var2=val2 QEMU_UNSET_ENV=LD_PRELOAD,LD_DEBUG\n"
            "Note that if you provide several changes to a single variable\n"
-           "the last change will stay in effect.\n");
+           "the last change will stay in effect.\n"
+           "\n"
+           QEMU_BUGREPORTS "\n");
 
     exit(exitcode);
 }
qemu-img.c +1 -1
index f4d5f0d77d..758719e083 100644
@@ -201,7 +201,7 @@ static void QEMU_NORETURN help(void)
 
     printf("%s\nSupported formats:", help_msg);
     bdrv_iterate_format(format_print, NULL);
-    printf("\n");
+    printf("\n\n" QEMU_BUGREPORTS "\n");
     exit(EXIT_SUCCESS);
 }
 
qemu-io.c +3 -2
index ec175630a6..b93553a603 100644
@@ -262,8 +262,9 @@ static void usage(const char *name)
 "  -h, --help           display this help and exit\n"
 "  -V, --version        output version information and exit\n"
 "\n"
-"See '%s -c help' for information on available commands."
-"\n",
+"See '%s -c help' for information on available commands.\n"
+"\n"
+QEMU_BUGREPORTS "\n",
     name, name);
 }
 
qemu-nbd.c +1 -1
index b8666bb575..052eb4d067 100644
@@ -123,7 +123,7 @@ static void usage(const char *name)
 "      --detect-zeroes=MODE  set detect-zeroes mode (off, on, unmap)\n"
 "      --image-opts          treat FILE as a full set of image options\n"
 "\n"
-"Report bugs to <[email protected]>\n"
+QEMU_BUGREPORTS "\n"
     , name, NBD_DEFAULT_PORT, "DEVICE");
 }
 
qga/main.c +1 -1
index b64c7ac2a2..56d5633c13 100644
@@ -249,7 +249,7 @@ QEMU_COPYRIGHT "\n"
 "                    options / command-line parameters to stdout\n"
 "  -h, --help        display this help and exit\n"
 "\n"
-"Report bugs to <[email protected]>\n"
+QEMU_BUGREPORTS "\n"
     , cmd, QGA_VIRTIO_PATH_DEFAULT, QGA_SERIAL_PATH_DEFAULT,
     dfl_pathnames.pidfile,
 #ifdef CONFIG_FSFREEZE
Signature · 1 line
2.13.3
Reviewed-by on the v3 series
#5 lore raw
In reply to Eric Blake
Quoted 17 lines · Eric Blake

Not sure if this should go through Kevin's block tree, Paolo's miscellaneous patches, or if I should just do a pull request myself (since patch 4 includes a change to qemu-nbd)

since v2: add R-b on 2-4; also sort 'qemu-img --help' create text

001/4:[0012] [FC] 'qemu-img: Sort sub-command names in --help' 002/4:[----] [--] 'qemu-io: Give more --version information' 003/4:[----] [--] 'qga: Give more --version information' 004/4:[----] [--] 'maint: Include bug-reporting info in --help output'

Eric Blake (4):
qemu-img: Sort sub-command names in --help
qemu-io: Give more --version information
qga: Give more --version information
maint: Include bug-reporting info in --help output

Quoted 11 lines
 include/qemu-common.h |  5 +++++
 vl.c                  |  4 +++-
 bsd-user/main.c       |  2 ++
 linux-user/main.c     |  4 +++-
 qemu-img.c            |  2 +-
 qemu-io.c             |  9 ++++++---
 qemu-nbd.c            |  2 +-
 qga/main.c            |  8 +++++---
 qemu-img-cmds.hx      | 21 ++++++++++++---------
 9 files changed, 38 insertions(+), 19 deletions(-)

Nothing to keep the commands from going out of order again, it looks like -- can this be added as a comment or otherwise scripted as a ./hey_it_looks_like_you_are_about_to_release_qemu.sh script that makes sure we've dotted the 'i's and crossed the 't's?

Lastly, Didn't we fix the certificate issue? (I thought Jeff had) -- and even if not, it's still the correct address to send people to IMO. Let people report to us if the SSL certificate appears to be broken.

Eh, regardless of shed coloring:

author
#6 lore raw
Quoted 9 lines · John Snow
Quoted 4 lines · Eric Blake

Not sure if this should go through Kevin's block tree, Paolo's miscellaneous patches, or if I should just do a pull request myself (since patch 4 includes a change to qemu-nbd)

Quoted 4 lines

Nothing to keep the commands from going out of order again, it looks like -- can this be added as a comment or otherwise scripted as a ./hey_it_looks_like_you_are_about_to_release_qemu.sh script that makes sure we've dotted the 'i's and crossed the 't's?

We don't add subcommands to qemu-img all that frequently; I think a comment is okay without having to figure out where to script things.

Quoted 4 lines

Lastly, Didn't we fix the certificate issue? (I thought Jeff had) -- and even if not, it's still the correct address to send people to IMO. Let people report to us if the SSL certificate appears to be broken.

That can be a followup-patch.

Quoted 5 lines

Eh, regardless of shed coloring:

Signature · 3 lines
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
#7 lore raw
Quoted 19 lines · Eric Blake
Quoted 9 lines · John Snow
Quoted 4 lines · Eric Blake

Not sure if this should go through Kevin's block tree, Paolo's miscellaneous patches, or if I should just do a pull request myself (since patch 4 includes a change to qemu-nbd)

Quoted 4 lines

Nothing to keep the commands from going out of order again, it looks like -- can this be added as a comment or otherwise scripted as a ./hey_it_looks_like_you_are_about_to_release_qemu.sh script that makes sure we've dotted the 'i's and crossed the 't's?

We don't add subcommands to qemu-img all that frequently; I think a comment is okay without having to figure out where to script things.

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

Lastly, Didn't we fix the certificate issue? (I thought Jeff had) -- and even if not, it's still the correct address to send people to IMO. Let people report to us if the SSL certificate appears to be broken.

That can be a followup-patch.

Probably no need for one, really. We force redirect to SSL, so the http://
versions will still end up https://.

And to confirm - the SSL certificates are now all in order. The issue on the website I think you were referencing in that commit message is because we still had two URL resources pulling in non-ssl assets (Google fonts, and jquery), so browsers blocked those mixed requests. But that has been updated.

-Jeff