From nobody Tue Dec 16 07:06:21 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152098219873061.976597880104805; Tue, 13 Mar 2018 16:03:18 -0700 (PDT) Received: from localhost ([::1]:43362 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evswm-0001dz-Qb for importer@patchew.org; Tue, 13 Mar 2018 19:03:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58000) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1evshx-0005eO-Cl for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1evshw-0003As-0u for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:49 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:40139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1evshv-00039j-Ls for qemu-devel@nongnu.org; Tue, 13 Mar 2018 18:47:47 -0400 Received: by mail-wm0-x242.google.com with SMTP id t6so879301wmt.5 for ; Tue, 13 Mar 2018 15:47:47 -0700 (PDT) Received: from donizetti.lan (94-36-191-219.adsl-ull.clienti.tiscali.it. [94.36.191.219]) by smtp.gmail.com with ESMTPSA id x107sm1557951wrb.97.2018.03.13.15.47.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Mar 2018 15:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=zjTnvIkfkzDm4gqzQY3QZRuTfgx3e9wQIbYkT4OIV24=; b=hbR8pHKHETRCxqNM94sPhakOP1loPsjoCzvl1pnq2Q1JVcFRIRrIRIuHQcUMwKSgMy F2qNpaQbbIAUpJYJHu4GVhp4yrt9EciO4hQ+Ktc0VKvEhSzxF3eocCLXUGBkkb68VxcB nZPpYKOKE5Sg13jRf6k+rd2TSwubh8xoE7EyeP3hIERbp7pd2eZRTaCZfiAeqOMnP6nv +SAJrwUfMbMGo+M5XlbapFMfhy7Lz5g1k9dy97ABUynPKtvCnnK9hJEI0/sC6cQufuGt uodVfGU8YvPdM8TIrjcXJvh+S8/YL8P0EYfVtEGdS3zbiSK5wSHMjgMWYSsczJnUAnDl +m1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=zjTnvIkfkzDm4gqzQY3QZRuTfgx3e9wQIbYkT4OIV24=; b=JUZEu0eSPqWygT6oNaHZ/pOI0Jv7FjeYzwfWQTMUV1vHWQi+giKlRNoVpUVa162G7i T4kc/erZUyx8wVoRRMKGV5Wqgh/1wmS5bq4ryh4BoIg07NnXqYW328bpbdRkhi0DcUED iQZLeb07Cj7CSOdjmeVB8wJ5uiis+2/by4B0Zb0aohfN6nhgdXD0ZKeBVEJvEU/Zh4va lMl/vT+OO9zEAxmSCjl62f4imKzNcbxUzSRq/Yh0BAkJDQwQROkRA+LmHmqTjzE9ss0Z objW9n4S3QzTsuwSVA44Yv3hSn6z3HvCNV+QtyXC0IOONPlxocs8xd0FJJ663TbQ6iiL vmMw== X-Gm-Message-State: AElRT7GkYagOFS8T4wlFzoAWtFHKAi+KdbkhaUwykoTV65oyqO33XtOV /ZuWYzQDORBsNJyNKLzXDvlPb0lB X-Google-Smtp-Source: AG47ELtUgekQMjuv3ZTSODiOIlzThZPLGOQ1id1CH1B5yjeZ0R7onubBD11mj9Yv2jElmjLNA0xH3Q== X-Received: by 10.28.207.207 with SMTP id f198mr5389wmg.0.1520981266096; Tue, 13 Mar 2018 15:47:46 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 13 Mar 2018 23:46:30 +0100 Message-Id: <20180313224719.4954-21-pbonzini@redhat.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313224719.4954-1-pbonzini@redhat.com> References: <20180313224719.4954-1-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PULL 20/69] Polish the version strings containing the package version X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Thomas Huth Since commit 67a1de0d195a there is no space anymore between the version number and the parentheses when running configure with --with-pkgversion=3Dfoo : $ qemu-system-s390x --version QEMU emulator version 2.11.50(foo) But the space is included when building without that option when building from a git checkout: $ qemu-system-s390x --version QEMU emulator version 2.11.50 (v2.11.0-1494-gbec9c64-dirty) The same confusion exists with the "query-version" QMP command. Let's fix this by introducing a proper QEMU_FULL_VERSION definition that includes the space and parentheses, while the QEMU_PKGVERSION should just cleanly contain the package version string itself. Note that this also changes the behavior of the "query-version" QMP command (the space and parentheses are not included there anymore), but that's supposed to be OK since the strings there are not meant to be parsed by other tools. Fixes: 67a1de0d195a6185c39b436159c9ffc7720bf979 Buglink: https://bugs.launchpad.net/qemu/+bug/1673373 Signed-off-by: Thomas Huth Message-Id: <1518692807-25859-1-git-send-email-thuth@redhat.com> Signed-off-by: Paolo Bonzini --- Makefile | 20 +++++++++++--------- bsd-user/main.c | 2 +- configure | 2 +- linux-user/main.c | 2 +- qemu-img.c | 2 +- qemu-io.c | 2 +- qemu-nbd.c | 2 +- qga/main.c | 2 +- scsi/qemu-pr-helper.c | 2 +- ui/cocoa.m | 2 +- vl.c | 2 +- 11 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 5d9ef3b8fd..416a81c7ca 100644 --- a/Makefile +++ b/Makefile @@ -434,21 +434,23 @@ all: $(DOCS) $(TOOLS) $(HELPERS-y) recurse-all modules qemu-version.h: FORCE $(call quiet-command, \ (cd $(SRC_PATH); \ - printf '#define QEMU_PKGVERSION '; \ if test -n "$(PKGVERSION)"; then \ - printf '"$(PKGVERSION)"\n'; \ + pkgvers=3D"$(PKGVERSION)"; \ else \ if test -d .git; then \ - printf '" ('; \ - git describe --match 'v*' 2>/dev/null | tr -d '\n'; \ + pkgvers=3D$$(git describe --match 'v*' 2>/dev/null | tr -d '\n');\ if ! git diff-index --quiet HEAD &>/dev/null; then \ - printf -- '-dirty'; \ + pkgvers=3D"$${pkgvers}-dirty"; \ fi; \ - printf ')"\n'; \ - else \ - printf '""\n'; \ fi; \ - fi) > $@.tmp) + fi; \ + printf "#define QEMU_PKGVERSION \"$${pkgvers}\"\n"; \ + if test -n "$${pkgvers}"; then \ + printf '#define QEMU_FULL_VERSION QEMU_VERSION " (" QEMU_PKGVERSION ")"= \n'; \ + else \ + printf '#define QEMU_FULL_VERSION QEMU_VERSION\n'; \ + fi; \ + ) > $@.tmp) $(call quiet-command, if ! cmp -s $@ $@.tmp; then \ mv $@.tmp $@; \ else \ diff --git a/bsd-user/main.c b/bsd-user/main.c index efef5ff8c5..05aa5594a9 100644 --- a/bsd-user/main.c +++ b/bsd-user/main.c @@ -649,7 +649,7 @@ void cpu_loop(CPUSPARCState *env) =20 static void usage(void) { - printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION + printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "usage: qemu-" TARGET_NAME " [options] program [arguments...]\n" "BSD CPU emulator (compiled for %s emulation)\n" diff --git a/configure b/configure index f74e1f3b7c..26d56eb5bb 100755 --- a/configure +++ b/configure @@ -1163,7 +1163,7 @@ for opt do ;; --disable-blobs) blobs=3D"no" ;; - --with-pkgversion=3D*) pkgversion=3D" ($optarg)" + --with-pkgversion=3D*) pkgversion=3D"$optarg" ;; --with-coroutine=3D*) coroutine=3D"$optarg" ;; diff --git a/linux-user/main.c b/linux-user/main.c index 7bc9bc79b0..abbd14e208 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -4163,7 +4163,7 @@ static void handle_arg_strace(const char *arg) =20 static void handle_arg_version(const char *arg) { - printf("qemu-" TARGET_NAME " version " QEMU_VERSION QEMU_PKGVERSION + printf("qemu-" TARGET_NAME " version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); exit(EXIT_SUCCESS); } diff --git a/qemu-img.c b/qemu-img.c index 088d89043e..855fa52514 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -46,7 +46,7 @@ #include "crypto/init.h" #include "trace/control.h" =20 -#define QEMU_IMG_VERSION "qemu-img version " QEMU_VERSION QEMU_PKGVERSION \ +#define QEMU_IMG_VERSION "qemu-img version " QEMU_FULL_VERSION \ "\n" QEMU_COPYRIGHT "\n" =20 typedef struct img_cmd_t { diff --git a/qemu-io.c b/qemu-io.c index 160fb2a89f..e692c555e0 100644 --- a/qemu-io.c +++ b/qemu-io.c @@ -558,7 +558,7 @@ int main(int argc, char **argv) trace_file =3D trace_opt_parse(optarg); break; case 'V': - printf("%s version " QEMU_VERSION QEMU_PKGVERSION "\n" + printf("%s version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n", progname); exit(0); case 'h': diff --git a/qemu-nbd.c b/qemu-nbd.c index ed5d9b5062..0af0560ad1 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -130,7 +130,7 @@ QEMU_HELP_BOTTOM "\n" static void version(const char *name) { printf( -"%s " QEMU_VERSION QEMU_PKGVERSION "\n" +"%s " QEMU_FULL_VERSION "\n" "Written by Anthony Liguori.\n" "\n" QEMU_COPYRIGHT "\n" diff --git a/qga/main.c b/qga/main.c index f9c83050c5..837a75a46a 100644 --- a/qga/main.c +++ b/qga/main.c @@ -218,7 +218,7 @@ static void usage(const char *cmd) { printf( "Usage: %s [-m -p ] []\n" -"QEMU Guest Agent " QEMU_VERSION QEMU_PKGVERSION "\n" +"QEMU Guest Agent " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n" "\n" " -m, --method transport method: one of unix-listen, virtio-serial,\= n" diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c index 9fe615c73c..3facbba170 100644 --- a/scsi/qemu-pr-helper.c +++ b/scsi/qemu-pr-helper.c @@ -102,7 +102,7 @@ QEMU_HELP_BOTTOM "\n" static void version(const char *name) { printf( -"%s " QEMU_VERSION QEMU_PKGVERSION "\n" +"%s " QEMU_FULL_VERSION "\n" "Written by Paolo Bonzini.\n" "\n" QEMU_COPYRIGHT "\n" diff --git a/ui/cocoa.m b/ui/cocoa.m index 18de0bb3ea..110b393e4e 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1330,7 +1330,7 @@ QemuCocoaView *cocoaView; /* Create the version string*/ NSString *version_string; version_string =3D [[NSString alloc] initWithFormat: - @"QEMU emulator version %s%s", QEMU_VERSION, QEMU_PKGVERSION]; + @"QEMU emulator version %s", QEMU_FULL_VERSION]; [version_label setStringValue: version_string]; [superView addSubview: version_label]; =20 diff --git a/vl.c b/vl.c index 26662eb9e7..e81152417a 100644 --- a/vl.c +++ b/vl.c @@ -1948,7 +1948,7 @@ static void main_loop(void) =20 static void version(void) { - printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n" + printf("QEMU emulator version " QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n"); } =20 --=20 2.14.3