RPM writes "(contains no files)" to stdout for packages with no files,
and thus we consider that string as single file in such packages.
Workaround this locally, so we do not get bogus files in the file
listing of RPMs with no files.
---
v2v/linux.ml | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/v2v/linux.ml b/v2v/linux.ml
index 6fd0eb50..5496d056 100644
--- a/v2v/linux.ml
+++ b/v2v/linux.ml
@@ -123,8 +123,16 @@ let file_list_of_package (g : Guestfs.guestfs) inspect app =
let cmd = [| "rpm"; "-ql"; pkg_name |] in
debug "%s" (String.concat " " (Array.to_list cmd));
let files = g#command_lines cmd in
- let files = Array.to_list files in
- List.sort compare files
+ (* RPM prints "(contains no files)" on stdout when a package
+ * has no files in it:
+ *
https://github.com/rpm-software-management/rpm/issues/962
+ *)
+ if files = [| "(contains no files)" |] then
+ []
+ else (
+ let files = Array.to_list files in
+ List.sort compare files
+ )
| format ->
error (f_"don’t know how to get list of files from package using %s")
--
2.26.2