From patchwork Mon Jun 27 03:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 12896047 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED528C433EF for ; Mon, 27 Jun 2022 04:11:44 +0000 (UTC) Received: from localhost ([::1]:60836 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5g6B-0004uf-Q7 for qemu-devel@archiver.kernel.org; Mon, 27 Jun 2022 00:11:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45946) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5fsw-0004gY-P3 for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:03 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:44832) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5fsu-0007zN-7e for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:02 -0400 Received: by mail-pj1-x102f.google.com with SMTP id n16-20020a17090ade9000b001ed15b37424so8166930pjv.3 for ; Sun, 26 Jun 2022 20:57:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pv04gkshDxNH3B9RohTSkXVFQo/HTk4n+LV9OX7qnAM=; b=Wk9odHKE8NFaKDug++ZBprDAxk7v41Zlhj75fNO/8bSmAbTgD/jJqjGVGD6xudomlP n3lvaf12dHFV7AxJ0QcLYHb2Xbp3m2ZierJW4gkzgmU2sJ4t2I8uxDvDaWvPNvZtiiVa ymKFFpVVZefdYLprnvmkv2y79UiRWd/0j3WfIDDzxRLFdAhr4eG6/+efrCzXOcZ1EyZv AlbNHmXEUbljc5zj7KR3U99sEWCXJDg/G9Kup7D/LC9JcYtZQgtFqLmTkhTf0GzU3WP4 CB43Rysify1Rg/tn4UJFRL0imeFITdtG/BOgblK2ApEcFuikkITbhEvOzIgAxBir5pKS EXtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pv04gkshDxNH3B9RohTSkXVFQo/HTk4n+LV9OX7qnAM=; b=eYyfQkNV54OGPzfbsNlAJZ0++vUD3su6yEg9PgjGmhcgUNXVz+lVg+5y+fQMEQUckf Vm5UnaYtLRw1/OXeyI0KDWr9Qh/ux+lAUhyNzbBG/UA2kwTb3BbSVrmedMUFWFBnMWv3 1bZfCHv0/QEL+rlPhWMBUL5p061A0EM9uM15MmK3CNrGu3Tgqgi2TECiHwtjnxN6l8iu It1epKJ5E5gRfBRl88NoyRk+isdbVQ1FqT4YIJhq6o/WvncGGDqNZMt+mNy401NV6T9Z ZMZ/6eNTa6q/gNymv10SNFBygA/lhdOnPFij85+5wrmE0p6f5iIj0IlDjckpmpzQNJQx XmMQ== X-Gm-Message-State: AJIora/0DwSdHCuXwXDs8tZ65wv72eZ7sRirR17bhd7waDRuIv1wNNOa BvjeEdOz09asKsKbEsoM9ts= X-Google-Smtp-Source: AGRyM1sD5/Q6UowBenRT4qF28od+2iGKCeVbA4LoQPnW84bp5Y/v7unbioJZMy+y8dDcynveROl5Vw== X-Received: by 2002:a17:90b:1d92:b0:1ed:38d5:c45e with SMTP id pf18-20020a17090b1d9200b001ed38d5c45emr13481478pjb.167.1656302278817; Sun, 26 Jun 2022 20:57:58 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b0052531985e3esm5951314pfo.22.2022.06.26.20.57.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 26 Jun 2022 20:57:58 -0700 (PDT) From: Akihiko Odaki To: Cc: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , John Snow , Cleber Rosa , Stefan Weil , Akihiko Odaki Subject: [PATCH v10 1/4] tests/vm: do not specify -bios option Date: Mon, 27 Jun 2022 12:57:41 +0900 Message-Id: <20220627035744.23218-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220627035744.23218-1-akihiko.odaki@gmail.com> References: <20220627035744.23218-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini When running from the build tree, the executable is able to find the BIOS on its own; when running from the source tree, a firmware blob should already be installed and there is no guarantee that the one in the source tree works with the QEMU that is being used for the installation. Just remove the -bios option, since it is unnecessary and in fact there are other x86 VM tests that do not bother specifying it. Signed-off-by: Paolo Bonzini Reviewed-by: Daniel P. Berrangé Reviewed-by: Thomas Huth Signed-off-by: Akihiko Odaki Message-Id: <20220616083025.116902-1-pbonzini@redhat.com> --- tests/vm/fedora | 1 - tests/vm/freebsd | 1 - tests/vm/netbsd | 1 - tests/vm/openbsd | 1 - 4 files changed, 4 deletions(-) diff --git a/tests/vm/fedora b/tests/vm/fedora index 92b78d6e2c9..12eca919a08 100755 --- a/tests/vm/fedora +++ b/tests/vm/fedora @@ -79,7 +79,6 @@ class FedoraVM(basevm.BaseVM): self.exec_qemu_img("create", "-f", "qcow2", img_tmp, self.size) self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso diff --git a/tests/vm/freebsd b/tests/vm/freebsd index 805db759d67..cd1fabde523 100755 --- a/tests/vm/freebsd +++ b/tests/vm/freebsd @@ -95,7 +95,6 @@ class FreeBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso diff --git a/tests/vm/netbsd b/tests/vm/netbsd index 45aa9a7fda7..aa883ec23c9 100755 --- a/tests/vm/netbsd +++ b/tests/vm/netbsd @@ -86,7 +86,6 @@ class NetBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-cdrom", iso ]) diff --git a/tests/vm/openbsd b/tests/vm/openbsd index 13c82542140..6f1b6f5b98a 100755 --- a/tests/vm/openbsd +++ b/tests/vm/openbsd @@ -82,7 +82,6 @@ class OpenBSDVM(basevm.BaseVM): self.print_step("Booting installer") self.boot(img_tmp, extra_args = [ - "-bios", "pc-bios/bios-256k.bin", "-machine", "graphics=off", "-device", "VGA", "-cdrom", iso From patchwork Mon Jun 27 03:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 12896050 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3BD39C433EF for ; Mon, 27 Jun 2022 04:18:16 +0000 (UTC) Received: from localhost ([::1]:44250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5gCT-0004gT-KQ for qemu-devel@archiver.kernel.org; Mon, 27 Jun 2022 00:18:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46060) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ft7-0004kZ-JU for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:15 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]:36859) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ft0-00083N-Fx for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:11 -0400 Received: by mail-pf1-x432.google.com with SMTP id x138so5122669pfc.3 for ; Sun, 26 Jun 2022 20:58:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FjxO46XsHWJrtLTWyqMQu9tqOFI4+SHoh1/rzrWg5PI=; b=fwKKMFz7PFq+alPES5fr5+xzerenlvhtpquxiufeP6sKYIQb5bRVUvj4upK0hOlc+3 DX8tn5ENd9MZiDGh/cXZq5D1Gk5RBa9St32CLvWh0Rykz+FxgiXAE6KBGxkuq9+UoUTq KEezCGetBk0ryiA0LNxDXyy8fTGOje/2P/sLghsAfuDP3bqS0kE7m0qIROgh4evXBGCT w3sG+uEry/F1Vh6C2oe0VWklRPvns/sU4woW1swR0UjqoUhRu+Co6w2/ObdRYiJCwsUQ DXEXao0QzF4l9H38gyRoI2dLdSO5ZKQxfZEi3QFj2G83PO5P4jOJrpZTAVVrRl+KPups d/yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FjxO46XsHWJrtLTWyqMQu9tqOFI4+SHoh1/rzrWg5PI=; b=bjUQu4rIb1c59qClSbdyFHkEmpNmP/EGwWpaiVE+vwBuVpF0JPN12SeX6E3xrOk8uf SJreiSEsAla+77WiJuO6kZpn5FnTUrfYk4BbaVWD/lkCClvHoxAhmTiNsFkV81KLoDBl qa5RefPjMQdQ0h6pNY7oglbU+RP+wNF2AXVl1Y+yEmUW8c+os8eu5xinVMOu5RgxnruR Gm4sq51dvnsMywYkfmHBoidvfb5Q2Nvtbgf3C1Dwe31zACg6NjCVI79UOdEGTjdJx9Z2 EcP389VHfyfxYHA786+nnO9H1bIVQmGJ6/dV3ZAhsEmn629TwAsUcORtD9/wxijpFSkx pYcQ== X-Gm-Message-State: AJIora8BySei7FAZIczrJ878TsyDDtxWNqf1UNdlvVq36LYwCL9VnPxU k0EKf95J5Ocoh6WOQ6q9Tuo= X-Google-Smtp-Source: AGRyM1uW9D3AMwgMB0Jf/LpHbFqr41KcDXn1viSerCf+6h64iFHgxAdIZ6TchZcGXMFO5mPXAueZpA== X-Received: by 2002:a63:8a4b:0:b0:40d:4365:a12a with SMTP id y72-20020a638a4b000000b0040d4365a12amr11233802pgd.218.1656302282884; Sun, 26 Jun 2022 20:58:02 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b0052531985e3esm5951314pfo.22.2022.06.26.20.57.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 26 Jun 2022 20:58:02 -0700 (PDT) From: Akihiko Odaki To: Cc: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , John Snow , Cleber Rosa , Stefan Weil , Akihiko Odaki Subject: [PATCH v10 2/4] cutils: Introduce bundle mechanism Date: Mon, 27 Jun 2022 12:57:42 +0900 Message-Id: <20220627035744.23218-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220627035744.23218-1-akihiko.odaki@gmail.com> References: <20220627035744.23218-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=akihiko.odaki@gmail.com; helo=mail-pf1-x432.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Developers often run QEMU without installing. The bundle mechanism allows to look up files which should be present in installation even in such a situation. It is a general mechanism and can find any files in the installation tree. The build tree will have a new directory, qemu-bundle, to represent what files the installation tree would have for reference by the executables. Note that it abandons compatibility with Windows older than 8. The extended support for the prior version, 7 ended more than 2 years ago, and it is unlikely that someone would like to run the latest QEMU on such an old system. Signed-off-by: Akihiko Odaki Suggested-by: Paolo Bonzini --- docs/about/build-platforms.rst | 2 +- include/qemu/cutils.h | 18 +++++++-- include/qemu/osdep.h | 2 +- meson.build | 4 ++ scripts/symlink-install-tree.py | 34 +++++++++++++++++ util/cutils.c | 68 +++++++++++++++++++++++---------- util/meson.build | 1 + 7 files changed, 103 insertions(+), 26 deletions(-) create mode 100755 scripts/symlink-install-tree.py diff --git a/docs/about/build-platforms.rst b/docs/about/build-platforms.rst index 1958edb4305..ebde20f9815 100644 --- a/docs/about/build-platforms.rst +++ b/docs/about/build-platforms.rst @@ -88,7 +88,7 @@ Windows The project aims to support the two most recent versions of Windows that are still supported by the vendor. The minimum Windows API that is currently -targeted is "Windows 7", so theoretically the QEMU binaries can still be run +targeted is "Windows 8", so theoretically the QEMU binaries can still be run on older versions of Windows, too. However, such old versions of Windows are not tested anymore, so it is recommended to use one of the latest versions of Windows instead. diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index d3e532b64c8..92c436d8c70 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -224,9 +224,21 @@ const char *qemu_get_exec_dir(void); * @dir: the directory (typically a `CONFIG_*DIR` variable) to be relocated. * * Returns a path for @dir that uses the directory of the running executable - * as the prefix. For example, if `bindir` is `/usr/bin` and @dir is - * `/usr/share/qemu`, the function will append `../share/qemu` to the - * directory that contains the running executable and return the result. + * as the prefix. + * + * When a directory named `qemu-bundle` exists in the directory of the running + * executable, the path to the directory will be prepended to @dir. For + * example, if the directory of the running executable is `/qemu/build` @dir + * is `/usr/share/qemu`, the result will be + * `/qemu/build/qemu-bundle/usr/share/qemu`. The directory is expected to exist + * in the build tree. + * + * Otherwise, the directory of the running executable will be used as the + * prefix and it appends the relative path from `bindir` to @dir. For example, + * if the directory of the running executable is `/opt/qemu/bin`, `bindir` is + * `/usr/bin` and @dir is `/usr/share/qemu`, the result will be + * `/opt/qemu/bin/../share/qemu`. + * * The returned string should be freed by the caller. */ char *get_relocated_path(const char *dir); diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index b1c161c035a..84f8b9d0243 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -75,7 +75,7 @@ QEMU_EXTERN_C int daemon(int, int); #ifdef _WIN32 /* as defined in sdkddkver.h */ #ifndef _WIN32_WINNT -#define _WIN32_WINNT 0x0601 /* Windows 7 API (should be in sync with glib) */ +#define _WIN32_WINNT 0x0602 /* Windows 8 API (should be in sync with glib) */ #endif /* reduces the number of implicitly included headers */ #ifndef WIN32_LEAN_AND_MEAN diff --git a/meson.build b/meson.build index 9efcb175d16..c49f5ebfc37 100644 --- a/meson.build +++ b/meson.build @@ -7,6 +7,8 @@ add_test_setup('quick', exclude_suites: ['slow', 'thorough'], is_default: true) add_test_setup('slow', exclude_suites: ['thorough'], env: ['G_TEST_SLOW=1', 'SPEED=slow']) add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough']) +meson.add_postconf_script('scripts/symlink-install-tree.py') + not_found = dependency('', required: false) keyval = import('keyval') ss = import('sourceset') @@ -356,10 +358,12 @@ nvmm =not_found hvf = not_found midl = not_found widl = not_found +pathcch = not_found host_dsosuf = '.so' if targetos == 'windows' midl = find_program('midl', required: false) widl = find_program('widl', required: false) + pathcch = cc.find_library('pathcch') socket = cc.find_library('ws2_32') winmm = cc.find_library('winmm') diff --git a/scripts/symlink-install-tree.py b/scripts/symlink-install-tree.py new file mode 100755 index 00000000000..59cf7e939f1 --- /dev/null +++ b/scripts/symlink-install-tree.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 + +from pathlib import PurePath +import errno +import json +import os +import subprocess +import sys + +def destdir_join(d1: str, d2: str) -> str: + if not d1: + return d2 + # c:\destdir + c:\prefix must produce c:\destdir\prefix + return str(PurePath(d1, *PurePath(d2).parts[1:])) + +introspect = os.environ.get('MESONINTROSPECT') +out = subprocess.run([*introspect.split(' '), '--installed'], + stdout=subprocess.PIPE, check=True).stdout +for source, dest in json.loads(out).items(): + assert os.path.isabs(source) + assert os.path.isabs(dest) + bundle_dest = destdir_join('qemu-bundle', dest) + path = os.path.dirname(bundle_dest) + try: + os.makedirs(path, exist_ok=True) + except BaseException as e: + print(f'error making directory {path}', file=sys.stderr) + raise e + try: + os.symlink(source, bundle_dest) + except BaseException as e: + if not isinstance(e, OSError) or e.errno != errno.EEXIST: + print(f'error making symbolic link {dest}', file=sys.stderr) + raise e diff --git a/util/cutils.c b/util/cutils.c index 6d04e52907b..8199dac5988 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -35,6 +35,11 @@ #include #endif +#ifdef G_OS_WIN32 +#include +#include +#endif + #include "qemu/ctype.h" #include "qemu/cutils.h" #include "qemu/error-report.h" @@ -1074,31 +1079,52 @@ char *get_relocated_path(const char *dir) /* Fail if qemu_init_exec_dir was not called. */ assert(exec_dir[0]); - if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { - return g_strdup(dir); - } result = g_string_new(exec_dir); + g_string_append(result, "/qemu-bundle"); + if (access(result->str, R_OK) == 0) { +#ifdef G_OS_WIN32 + size_t size = mbsrtowcs(NULL, &dir, 0, &(mbstate_t){0}) + 1; + PWSTR wdir = g_new(WCHAR, size); + mbsrtowcs(wdir, &dir, size, &(mbstate_t){0}); + + PCWSTR wdir_skipped_root; + PathCchSkipRoot(wdir, &wdir_skipped_root); + + size = wcsrtombs(NULL, &wdir_skipped_root, 0, &(mbstate_t){0}); + char *cursor = result->str + result->len; + g_string_set_size(result, result->len + size); + wcsrtombs(cursor, &wdir_skipped_root, size + 1, &(mbstate_t){0}); + g_free(wdir); +#else + g_string_append(result, dir); +#endif + } else if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) { + g_string_assign(result, dir); + } else { + g_string_assign(result, exec_dir); + + /* Advance over common components. */ + len_dir = len_bindir = prefix_len; + do { + dir += len_dir; + bindir += len_bindir; + dir = next_component(dir, &len_dir); + bindir = next_component(bindir, &len_bindir); + } while (len_dir && len_dir == len_bindir && !memcmp(dir, bindir, len_dir)); + + /* Ascend from bindir to the common prefix with dir. */ + while (len_bindir) { + bindir += len_bindir; + g_string_append(result, "/.."); + bindir = next_component(bindir, &len_bindir); + } - /* Advance over common components. */ - len_dir = len_bindir = prefix_len; - do { - dir += len_dir; - bindir += len_bindir; - dir = next_component(dir, &len_dir); - bindir = next_component(bindir, &len_bindir); - } while (len_dir && len_dir == len_bindir && !memcmp(dir, bindir, len_dir)); - - /* Ascend from bindir to the common prefix with dir. */ - while (len_bindir) { - bindir += len_bindir; - g_string_append(result, "/.."); - bindir = next_component(bindir, &len_bindir); + if (*dir) { + assert(G_IS_DIR_SEPARATOR(dir[-1])); + g_string_append(result, dir - 1); + } } - if (*dir) { - assert(G_IS_DIR_SEPARATOR(dir[-1])); - g_string_append(result, dir - 1); - } return g_string_free(result, false); } diff --git a/util/meson.build b/util/meson.build index 8f16018cd43..6cacb8689f1 100644 --- a/util/meson.build +++ b/util/meson.build @@ -23,6 +23,7 @@ util_ss.add(when: 'CONFIG_WIN32', if_true: files('event_notifier-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: files('qemu-thread-win32.c')) util_ss.add(when: 'CONFIG_WIN32', if_true: winmm) +util_ss.add(when: 'CONFIG_WIN32', if_true: pathcch) util_ss.add(files('envlist.c', 'path.c', 'module.c')) util_ss.add(files('host-utils.c')) util_ss.add(files('bitmap.c', 'bitops.c')) From patchwork Mon Jun 27 03:57:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 12896049 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70BA6C433EF for ; Mon, 27 Jun 2022 04:16:20 +0000 (UTC) Received: from localhost ([::1]:42200 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5gAd-0003H3-CI for qemu-devel@archiver.kernel.org; Mon, 27 Jun 2022 00:16:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ft5-0004kE-GE for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:15 -0400 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]:39607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ft3-00083f-Kh for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:11 -0400 Received: by mail-pg1-x529.google.com with SMTP id q140so7951144pgq.6 for ; Sun, 26 Jun 2022 20:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vwv4FPGt6FeS4iOQvh4mjchV/ZSf2nl3arPW8BgJEEg=; b=Jg47X/7p35hg0zHG9oAy+j/mWvQSFcc/RwknNhk8s6vxKn7+L9X/ufmT94HwnRX4Hu 1O391eibGi/ecXVZbCcIyEWVBaxhuADH81VzfxOub4NSjj30WVNOpAZod9ToiAr8Vv5i ydifi2+6k3khkP2p5/qJZliJqnk0BNXXMRm4oDSGebVnoDh4xbaZeqJWBfQGOLgajp+h lvR/4+r9d1mRRjGUftsrh6J85hl2UVl77qL99N7Y9SxMeT/1v8SjBDU2rpX+UC9H2Miy rE4CcInLQQBckOQYw1fXZC7joIQZkDLgDonclq6wxu9jl6Pw7C+bImAdTplXq/e7BKsj GkEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vwv4FPGt6FeS4iOQvh4mjchV/ZSf2nl3arPW8BgJEEg=; b=sQLgEX3tVAM8CPiY0kCx7FW3enPcaISpVNlA/LnQ/ikGMvvz1u0GKREX1Ud48BYfAh DcBP1GtfOV5+EaobVevzwVehksLWetAEFWfs5nsvWrOuModv6efGev4TYCfEB/aiaT3u YaJcICERC8nRPoyqrDTz+lN6fjJHKSw9SWW3Qmhb3RuKlpbSxiXSKWl8el3bjunxrKCA TFUaq8MfR4UTgEU8J9ARZq5YKm+Ge10o2FqCV8QzZtY3V/6hIB4NR3v6NqQrcPqrcd/w qBqD7uEtpd385JsmiBtbB44FZQnffH6/JGPGIE4RaTtAWRYC9FOM+5t3ZtIplSKYs0Nq nQOw== X-Gm-Message-State: AJIora+gTp1wKXOLVO6SeeYmdEYA6pV5FI4PqMNJyjiCmRSF1JAqwxVl XQU0lkA/sOXaKZkN1uYT5ngohY2Z+b4= X-Google-Smtp-Source: AGRyM1u9WWt0NPHrysGVcBe84JnGZOvyD5rYMaIm+fX2qj6wZden6gbHa51msCIhsBq+A31F8qOD6g== X-Received: by 2002:a05:6a00:140a:b0:4e0:54d5:d01 with SMTP id l10-20020a056a00140a00b004e054d50d01mr12589248pfu.20.1656302287204; Sun, 26 Jun 2022 20:58:07 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b0052531985e3esm5951314pfo.22.2022.06.26.20.58.03 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 26 Jun 2022 20:58:06 -0700 (PDT) From: Akihiko Odaki To: Cc: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , John Snow , Cleber Rosa , Stefan Weil , Akihiko Odaki Subject: [PATCH v10 3/4] datadir: Use bundle mechanism Date: Mon, 27 Jun 2022 12:57:43 +0900 Message-Id: <20220627035744.23218-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220627035744.23218-1-akihiko.odaki@gmail.com> References: <20220627035744.23218-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x529.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" softmmu/datadir.c had its own implementation to find files in the build tree, but now bundle mechanism provides the unified implementation which works for datadir and the other files. Signed-off-by: Akihiko Odaki --- .travis.yml | 2 +- pc-bios/keymaps/meson.build | 21 ++++++--------------- pc-bios/meson.build | 13 +++---------- scripts/oss-fuzz/build.sh | 2 +- softmmu/datadir.c | 22 +--------------------- tests/qtest/fuzz/fuzz.c | 15 --------------- 6 files changed, 12 insertions(+), 63 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9afc4a54b8f..4fdc9a67855 100644 --- a/.travis.yml +++ b/.travis.yml @@ -223,7 +223,7 @@ jobs: - BUILD_RC=0 && make -j${JOBS} || BUILD_RC=$? - | if [ "$BUILD_RC" -eq 0 ] ; then - mv pc-bios/s390-ccw/*.img pc-bios/ ; + mv pc-bios/s390-ccw/*.img qemu-bundle/usr/local/share/qemu ; ${TEST_CMD} ; else $(exit $BUILD_RC); diff --git a/pc-bios/keymaps/meson.build b/pc-bios/keymaps/meson.build index 44247a12b54..2837eb34f4e 100644 --- a/pc-bios/keymaps/meson.build +++ b/pc-bios/keymaps/meson.build @@ -40,9 +40,9 @@ else endif cp = find_program('cp') -t = [] -foreach km, args: keymaps - if native_qemu_keymap.found() +if native_qemu_keymap.found() + t = [] + foreach km, args: keymaps # generate with qemu-kvm t += custom_target(km, build_by_default: true, @@ -50,20 +50,11 @@ foreach km, args: keymaps command: [native_qemu_keymap, '-f', '@OUTPUT@', args.split()], install: true, install_dir: qemu_datadir / 'keymaps') - else - # copy from source tree - t += custom_target(km, - build_by_default: true, - input: km, - output: km, - command: [cp, '@INPUT@', '@OUTPUT@'], - install: true, - install_dir: qemu_datadir / 'keymaps') - endif -endforeach + endforeach -if native_qemu_keymap.found() alias_target('update-keymaps', t) +else + install_data(keymaps.keys(), install_dir: qemu_datadir / 'keymaps') endif install_data(['sl', 'sv'], install_dir: qemu_datadir / 'keymaps') diff --git a/pc-bios/meson.build b/pc-bios/meson.build index 41ba1c0ec7b..388e0db6e40 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -85,16 +85,9 @@ blobs = [ 'vof-nvram.bin', ] -ln_s = [find_program('ln', required: true), '-sf'] -foreach f : blobs - roms += custom_target(f, - build_by_default: have_system, - output: f, - input: files('meson.build'), # dummy input - install: get_option('install_blobs'), - install_dir: qemu_datadir, - command: [ ln_s, meson.project_source_root() / 'pc-bios' / f, '@OUTPUT@' ]) -endforeach +if get_option('install_blobs') + install_data(blobs, install_dir: qemu_datadir) +endif subdir('descriptors') subdir('keymaps') diff --git a/scripts/oss-fuzz/build.sh b/scripts/oss-fuzz/build.sh index 98b56e05210..16316b25662 100755 --- a/scripts/oss-fuzz/build.sh +++ b/scripts/oss-fuzz/build.sh @@ -88,7 +88,7 @@ if [ "$GITLAB_CI" != "true" ]; then fi # Copy over the datadir -cp -r ../pc-bios/ "$DEST_DIR/pc-bios" +cp -r ../pc-bios/ "$DEST_DIR/data" targets=$(./qemu-fuzz-i386 | awk '$1 ~ /\*/ {print $2}') base_copy="$DEST_DIR/qemu-fuzz-i386-target-$(echo "$targets" | head -n 1)" diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 160cac999a6..697cffea932 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -83,26 +83,6 @@ void qemu_add_data_dir(char *path) data_dir[data_dir_idx++] = path; } -/* - * Find a likely location for support files using the location of the binary. - * When running from the build tree this will be "$bindir/pc-bios". - * Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated). - * - * The caller must use g_free() to free the returned data when it is - * no longer required. - */ -static char *find_datadir(void) -{ - g_autofree char *dir = NULL; - - dir = g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL); - if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { - return g_steal_pointer(&dir); - } - - return get_relocated_path(CONFIG_QEMU_DATADIR); -} - void qemu_add_default_firmwarepath(void) { char **dirs; @@ -116,7 +96,7 @@ void qemu_add_default_firmwarepath(void) g_strfreev(dirs); /* try to find datadir relative to the executable path */ - qemu_add_data_dir(find_datadir()); + qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_DATADIR)); } void qemu_list_data_dirs(void) diff --git a/tests/qtest/fuzz/fuzz.c b/tests/qtest/fuzz/fuzz.c index 0ad4ba9e94d..2062b40d82b 100644 --- a/tests/qtest/fuzz/fuzz.c +++ b/tests/qtest/fuzz/fuzz.c @@ -174,21 +174,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv, char ***envp) target_name = strstr(**argv, "-target-"); if (target_name) { /* The binary name specifies the target */ target_name += strlen("-target-"); - /* - * With oss-fuzz, the executable is kept in the root of a directory (we - * cannot assume the path). All data (including bios binaries) must be - * in the same dir, or a subdir. Thus, we cannot place the pc-bios so - * that it would be in exec_dir/../pc-bios. - * As a workaround, oss-fuzz allows us to use argv[0] to get the - * location of the executable. Using this we add exec_dir/pc-bios to - * the datadirs. - */ - bindir = qemu_get_exec_dir(); - datadir = g_build_filename(bindir, "pc-bios", NULL); - if (g_file_test(datadir, G_FILE_TEST_IS_DIR)) { - qemu_add_data_dir(datadir); - } else { - g_free(datadir); } } else if (*argc > 1) { /* The target is specified as an argument */ target_name = (*argv)[1]; From patchwork Mon Jun 27 03:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akihiko Odaki X-Patchwork-Id: 12896048 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1A5E8C433EF for ; Mon, 27 Jun 2022 04:12:09 +0000 (UTC) Received: from localhost ([::1]:33510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5g6a-0005VL-50 for qemu-devel@archiver.kernel.org; Mon, 27 Jun 2022 00:12:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ftG-0004tc-En for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:23 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:42516) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ft7-00086C-BM for qemu-devel@nongnu.org; Sun, 26 Jun 2022 23:58:20 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 73-20020a17090a0fcf00b001eaee69f600so8192376pjz.1 for ; Sun, 26 Jun 2022 20:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=so1aZRcDpyrdxlBJDv3CBb5TATsqmUYPZ6aYDaBQuyc=; b=YL8DEq0V/gw9CQhl3Ds2FL2MNZsumrkI+fAT4qnJM4W75SDxMrcPW62e8esakHJ1Z2 uZwwZk9bph+1iFHYLmMFJxI6dZRNU4tcoBgw+CHTpBHSN+NAHCjuCYOGtBzunR0D7jU1 tIDH3vnWP4YrhIBnQaFo/KJUiSTVaQRqM0cWHv7fi3GzF9/h6scK+kNAH7d2IPC7G748 Vzh+nwKwPSXbtLWIYinLwK0mnMqY0E8JDc4FbzvR+2ExaQSq+nCf9AtVGVo/wEzVQzmC Ook6Hyj/YonV/I6HOFR3PNcbTQ8kfu7+g0awvV44wFZNGSFyF2oJe7FjSpoD+kGyA/8P FtGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=so1aZRcDpyrdxlBJDv3CBb5TATsqmUYPZ6aYDaBQuyc=; b=so/81GEIoC3DtsPlVATIGNbBZd8k1KYFS78gPo7c3ju4FV/SW5T6wMjSMdZnpZd+bE YgXBeOqNtu3XLCtHlokHij+ouyqswGfXnFdyPy1SMJDjbUd9x8gO7CIWxwiHqnprod9T A0gDPMpuoXic5JqekoiNfxeIe20vwWJqBVclnD8JwZ7Vf5W5rGCwW+Ck/1uH2CC9nQdE ZKvhccw8ONYdHPDLadu/mXALC4ESuPH1Gw/1T5bNiGZbqiATV8rkc9+AOqiwrpRLADdl bMncmt2u/y0QnCGOZzcuKfUDNlC767h7TeZPwmZ1y3eGvLFrBUWOLWcAXyXad2xMz0P4 Zh6Q== X-Gm-Message-State: AJIora9TMqxX90sucBwkzMXTqYRK0Xz8bYbCfulny+GMh0mA55bLsf83 FCsq4wjJBfFjeXYaYRV15XQ= X-Google-Smtp-Source: AGRyM1vuwURHBvG4brp2YcTIok5muGisQcR9N+Kpki4sXu4xOqCHC51WGhBa4LPsc7Nb7EKZS1bRCQ== X-Received: by 2002:a17:902:ec91:b0:16a:32fb:49c5 with SMTP id x17-20020a170902ec9100b0016a32fb49c5mr12401164plg.157.1656302291252; Sun, 26 Jun 2022 20:58:11 -0700 (PDT) Received: from localhost.localdomain ([157.82.194.15]) by smtp.gmail.com with ESMTPSA id a9-20020aa78649000000b0052531985e3esm5951314pfo.22.2022.06.26.20.58.07 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 26 Jun 2022 20:58:10 -0700 (PDT) From: Akihiko Odaki To: Cc: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Daniel_P_=2E_Berrang=C3=A9?= , Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth , John Snow , Cleber Rosa , Stefan Weil , Akihiko Odaki Subject: [PATCH v10 4/4] module: Use bundle mechanism Date: Mon, 27 Jun 2022 12:57:44 +0900 Message-Id: <20220627035744.23218-5-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220627035744.23218-1-akihiko.odaki@gmail.com> References: <20220627035744.23218-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102c.google.com X-Spam_score_int: 12 X-Spam_score: 1.2 X-Spam_bar: + X-Spam_report: (1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Before this change, the directory of the executable was being added to resolve modules in the build tree. However, get_relocated_path() can now resolve them with the new bundle mechanism. Signed-off-by: Akihiko Odaki --- util/module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/util/module.c b/util/module.c index 6bb4ad915a1..8ddb0e18f51 100644 --- a/util/module.c +++ b/util/module.c @@ -274,7 +274,6 @@ bool module_load_one(const char *prefix, const char *lib_name, bool mayfail) dirs[n_dirs++] = g_strdup_printf("%s", search_dir); } dirs[n_dirs++] = get_relocated_path(CONFIG_QEMU_MODDIR); - dirs[n_dirs++] = g_strdup(qemu_get_exec_dir()); #ifdef CONFIG_MODULE_UPGRADES version_dir = g_strcanon(g_strdup(QEMU_PKGVERSION),