qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] util/cutil: Allow relocatable install with prefix /
@ 2024-01-23 10:06 Bin Meng
  2024-01-24  3:25 ` Akihiko Odaki
  0 siblings, 1 reply; 2+ messages in thread
From: Bin Meng @ 2024-01-23 10:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Akihiko Odaki, Eric Blake, Hanna Czenczek, Paolo Bonzini,
	Philippe Mathieu-Daudé

When configuring QEMU with --prefix=/, the generated QEMU executables
can't be relocated to other directories. Add an additional test logic
in starts_with_prefix() to handle this.

Signed-off-by: Bin Meng <bin.meng@windriver.com>

---

 util/cutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/util/cutils.c b/util/cutils.c
index 42364039a5..676bd757ba 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -1021,7 +1021,8 @@ static inline bool starts_with_prefix(const char *dir)
 #pragma GCC diagnostic ignored "-Warray-bounds="
 #endif
     return !memcmp(dir, CONFIG_PREFIX, prefix_len) &&
-        (!dir[prefix_len] || G_IS_DIR_SEPARATOR(dir[prefix_len]));
+        (!dir[prefix_len] || G_IS_DIR_SEPARATOR(dir[prefix_len]) ||
+         !strcmp(CONFIG_PREFIX, "/"));
 #pragma GCC diagnostic pop
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] util/cutil: Allow relocatable install with prefix /
  2024-01-23 10:06 [PATCH] util/cutil: Allow relocatable install with prefix / Bin Meng
@ 2024-01-24  3:25 ` Akihiko Odaki
  0 siblings, 0 replies; 2+ messages in thread
From: Akihiko Odaki @ 2024-01-24  3:25 UTC (permalink / raw)
  To: Bin Meng, qemu-devel
  Cc: Eric Blake, Hanna Czenczek, Paolo Bonzini,
	Philippe Mathieu-Daudé

On 2024/01/23 19:06, Bin Meng wrote:
> When configuring QEMU with --prefix=/, the generated QEMU executables
> can't be relocated to other directories. Add an additional test logic
> in starts_with_prefix() to handle this.

What about setting "" as CONFIG_PREFIX in Meson when --prefix=/ ?

CONFIG_PREFIX is expected not to have the ending slash. --prefix needs 
the ending slash for the root, but it is just a quirk of Meson, which is 
probably better to be handled in Meson, too.

Regards,
Akihiko Odaki


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-24  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-23 10:06 [PATCH] util/cutil: Allow relocatable install with prefix / Bin Meng
2024-01-24  3:25 ` Akihiko Odaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).