mrc0mmand / rpms / libguestfs

Forked from rpms/libguestfs 3 years ago
Clone

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

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