On Monday, 1 August 2016 14:46:14 CEST Tomáš Golembiovský wrote:
What was happening in file_owner function did not match the
description
in the comment. When a path is owned by multiple packages the returned
string was in fact a concatenation of the names of all packages that own
it. E.g. for `Linux.is_file_owned g inspect "/etc"` the returned value
was "filesystemyum" (i.e. "filesystem" + "yum").
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/linux.ml | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/v2v/linux.ml b/v2v/linux.ml
index d20194b..aeff5c5 100644
--- a/v2v/linux.ml
+++ b/v2v/linux.ml
@@ -99,14 +99,18 @@ let rec file_owner g inspect path =
(* Although it is possible in RPM for multiple packages to own
* a file, this deliberately only returns one package.
*)
- let cmd = [| "rpm"; "-qf"; "--qf";
"%{NAME}"; path |] in
+ let cmd = [| "rpm"; "-qf"; "--qf";
"%{NAME}\\n"; path |] in
debug "%s" (String.concat " " (Array.to_list cmd));
- (try g#command cmd
+ (try
+ let pkgs = g#command_lines cmd in
+ pkgs.(0)
with Guestfs.Error msg as exn ->
if String.find msg "is not owned" >= 0 then
raise Not_found
else
raise exn
+ | Invalid_argument msg ->
+ raise Not_found
Just fixed the indentation of this "raise", but otherwise this patch
LGTM.
Pushed, thank you.
--
Pino Toscano