Kernel modules can be also symlinks to files available outside the
"canonical" module directory; since `file` by default does not deference
symlinks, passing directly symlinks to the architecture detection
results in errors, as the "file" API does not recognize "symbolic link"
as architecture.

To prevent this situation, canonicalize the path of the module picked
for architecture detection: this way, "file-architecture" will run on a
real file.
---
 v2v/linux_kernels.ml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/v2v/linux_kernels.ml b/v2v/linux_kernels.ml
index 3313aabc7..889ec2f2a 100644
--- a/v2v/linux_kernels.ml
+++ b/v2v/linux_kernels.ml
@@ -189,7 +189,7 @@ let detect_kernels (g : G.guestfs) inspect family 
bootloader =
               *)
              let arch =
                let any_module = modpath ^ List.hd modules in
-               g#file_architecture any_module in
+               g#file_architecture (g#realpath any_module) in
 
              (* Just return the module names, without path or extension. *)
              let modules = List.filter_map (
-- 
2.20.1

_______________________________________________
Libguestfs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to