qemu: Fix -version with configure --with-pkgversion
PATCH 1/1 qemu: Fix -version with configure --with-pkgversion
This appears to have regressed in 67a1de0d19.
When the configure --with-pkgversion=foo option is used, the output from -version will look like:
QEMU emulator version 2.8.90(foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
After this patch, it will be:
QEMU emulator version 2.8.90 (foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
--- Makefile | 2 +- configure | 2 +- vl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Makefile +1 -1
@@ -289,7 +289,7 @@ qemu-version.h: FORCE printf '"$(PKGVERSION)"\n'; \ else \ if test -d .git; then \ - printf '" ('; \ + printf '"('; \ git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ if ! git diff-index --quiet HEAD &>/dev/null; then \ printf -- '-dirty'; \
configure +1 -1
@@ -1004,7 +1004,7 @@ for opt do ;; --disable-blobs) blobs="no" ;; - --with-pkgversion=*) pkgversion=" ($optarg)" + --with-pkgversion=*) pkgversion="($optarg)" ;; --with-coroutine=*) coroutine="$optarg" ;;
vl.c +1 -1
@@ -1904,7 +1904,7 @@ static void main_loop(void)static void version (void ) { -printf ("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" +printf ("QEMU emulator version " QEMU_VERSION " " QEMU_PKGVERSION "\n" QEMU_COPYRIGHT "\n" ); }
Signature · 1 line
2.11.0
Quoted 55 lines · Jordan Justen
This appears to have regressed in
67a1de0d19.When the configure --with-pkgversion=foo option is used, the output from -version will look like:
QEMU emulator version 2.8.90(foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developersAfter this patch, it will be:
QEMU emulator version 2.8.90 (foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developersCc Paolo Bonzini <[email protected]>Cc Fam Zheng <[email protected]>Signed-off-by Jordan Justen <[email protected]>--- Makefile | 2 +- configure | 2 +- vl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)Makefile +1
-1@@ -289,7 +289,7 @@ qemu-version.h: FORCE printf '"$(PKGVERSION)"\n'; \ else \ if test -d .git; then \ - printf '" ('; \ + printf '"('; \ git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ if ! git diff-index --quiet HEAD &>/dev/null; then \ printf -- '-dirty'; \configure +1
-1@@ -1004,7 +1004,7 @@ for opt do ;; --disable-blobs) blobs="no" ;; - --with-pkgversion=*) pkgversion=" ($optarg)" + --with-pkgversion=*) pkgversion="($optarg)" ;; --with-coroutine=*) coroutine="$optarg" ;;vl.c +0
-0
vl.c static void main_loop(void) · line 1909
Quoted 7 lines
vl.c +1
-1@@ -1904,7 +1904,7 @@ static void main_loop(void)static void version (void ) { -printf ("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" +printf ("QEMU emulator version " QEMU_VERSION " " QEMU_PKGVERSION "\n" QEMU_COPYRIGHT "\n" ); }
Quoted 55 lines · Jordan Justen
This appears to have regressed in
67a1de0d19.When the configure --with-pkgversion=foo option is used, the output from -version will look like:
QEMU emulator version 2.8.90(foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developersAfter this patch, it will be:
QEMU emulator version 2.8.90 (foo)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developersCc Paolo Bonzini <[email protected]>Cc Fam Zheng <[email protected]>Signed-off-by Jordan Justen <[email protected]>--- Makefile | 2 +- configure | 2 +- vl.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)Makefile +1
-1@@ -289,7 +289,7 @@ qemu-version.h: FORCE printf '"$(PKGVERSION)"\n'; \ else \ if test -d .git; then \ - printf '" ('; \ + printf '"('; \ git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ if ! git diff-index --quiet HEAD &>/dev/null; then \ printf -- '-dirty'; \configure +1
-1@@ -1004,7 +1004,7 @@ for opt do ;; --disable-blobs) blobs="no" ;; - --with-pkgversion=*) pkgversion=" ($optarg)" + --with-pkgversion=*) pkgversion="($optarg)" ;; --with-coroutine=*) coroutine="$optarg" ;;vl.c +0
-0
vl.c static void main_loop(void) · line 1909
Quoted 7 lines
vl.c +1
-1@@ -1904,7 +1904,7 @@ static void main_loop(void)static void version (void ) { -printf ("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" +printf ("QEMU emulator version " QEMU_VERSION " " QEMU_PKGVERSION "\n" QEMU_COPYRIGHT "\n" ); }
This is not the only place where we assemble a string from QEMU_VERSION QEMU_PKGVERSION, so if you want to change from the original approach where QEMU_PKGVERSION had a space in it then you need to change the other places too.
Also it looks like we return QEMU_PKGVERSION as part of the QMP qmp_query_version() code, so we should check to see what the expected behaviour there is regarding having the space or not.
I think when I wrote those printfs I was expecting that QEMU_PKGVERSION might be a "-something" kind of string, and so did whoever wrote the commit log for 67a1de0d19. However looking at git history it seems to have always been a " (something)" format, so obviously some confusion here...
thanks
-- PMM