mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

Blame SOURCES/0003-v2v-linux-canonicalize-module-path-for-arch-detectio.patch

a034fe
From 0dc49c47060b35f6cffe73467823a07c4ca37e9e Mon Sep 17 00:00:00 2001
a034fe
From: Pino Toscano <ptoscano@redhat.com>
a034fe
Date: Wed, 20 Mar 2019 16:55:05 +0100
a034fe
Subject: [PATCH] v2v: linux: canonicalize module path for arch detection
a034fe
 (RHBZ#1690574)
a034fe
a034fe
Kernel modules can be also symlinks to files available outside the
a034fe
"canonical" module directory; the "file" API, used by the
a034fe
"file-architecture" API, return the actual type of a file (so symlinks,
a034fe
block devices, etc), and thus "file-architecture" fails on symlinks.
a034fe
a034fe
To prevent this situation, canonicalize the path of the module picked
a034fe
for architecture detection: this way, "file-architecture" will act on a
a034fe
real file.
a034fe
a034fe
(cherry picked from commit 0a093035d485b3c2e66d56541ebe159f1b632ba6)
a034fe
---
a034fe
 v2v/linux_kernels.ml | 2 +-
a034fe
 1 file changed, 1 insertion(+), 1 deletion(-)
a034fe
a034fe
diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml
a034fe
index 3313aabc7..889ec2f2a 100644
a034fe
--- a/v2v/linux_kernels.ml
a034fe
+++ b/v2v/linux_kernels.ml
a034fe
@@ -189,7 +189,7 @@ let detect_kernels (g : G.guestfs) inspect family bootloader =
a034fe
               *)
a034fe
              let arch =
a034fe
                let any_module = modpath ^ List.hd modules in
a034fe
-               g#file_architecture any_module in
a034fe
+               g#file_architecture (g#realpath any_module) in
a034fe
 
a034fe
              (* Just return the module names, without path or extension. *)
a034fe
              let modules = List.filter_map (
a034fe
-- 
a034fe
2.21.0
a034fe