mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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