Blame SOURCES/0026-common-Adapt-to-renamed-function-On_exit.rmdir-On_ex.patch

696189
From ea881513e9c15b0a816d3ba4afe471ff2f591a03 Mon Sep 17 00:00:00 2001
696189
From: "Richard W.M. Jones" <rjones@redhat.com>
696189
Date: Thu, 14 Jul 2022 12:44:27 +0100
696189
Subject: [PATCH] common: Adapt to renamed function On_exit.rmdir ->
696189
 On_exit.rm_rf
696189
696189
This function was renamed to make it clearer what it does (and that
696189
it's potentially dangerous).  The functionality is unchanged.
696189
696189
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
696189
(cherry picked from commit 2eb6441264deb0411d36dabaf8fb2da9f07c8439)
696189
---
696189
 common                         | 2 +-
696189
 input/OVA.ml                   | 2 +-
696189
 input/parse_domain_from_vmx.ml | 2 +-
696189
 lib/nbdkit.ml                  | 2 +-
696189
 lib/qemuNBD.ml                 | 2 +-
696189
 lib/utils.ml                   | 2 +-
696189
 output/python_script.ml        | 2 +-
696189
 7 files changed, 7 insertions(+), 7 deletions(-)
696189
696189
Submodule common af6cb55b..fd964c1b:
696189
diff --git a/common/mlcustomize/guest_packages.ml b/common/mlcustomize/guest_packages.ml
696189
index 4c3c34ed..7c29a2ab 100644
696189
--- a/common/mlcustomize/guest_packages.ml
696189
+++ b/common/mlcustomize/guest_packages.ml
696189
@@ -73,9 +73,9 @@ let install_command packages package_management =
696189
   | "zypper" -> sprintf "zypper -n in -l %s" quoted_args
696189
 
696189
   | "unknown" ->
696189
-    error_unknown_package_manager (s_"--install")
696189
+    error_unknown_package_manager "--install"
696189
   | pm ->
696189
-    error_unimplemented_package_manager (s_"--install") pm
696189
+    error_unimplemented_package_manager "--install" pm
696189
 
696189
 let update_command package_management =
696189
   match package_management with
696189
@@ -103,9 +103,9 @@ let update_command package_management =
696189
   | "zypper" -> "zypper -n update -l"
696189
 
696189
   | "unknown" ->
696189
-    error_unknown_package_manager (s_"--update")
696189
+    error_unknown_package_manager "--update"
696189
   | pm ->
696189
-    error_unimplemented_package_manager (s_"--update") pm
696189
+    error_unimplemented_package_manager "--update" pm
696189
 
696189
 let uninstall_command packages package_management =
696189
   let quoted_args = String.concat " " (List.map quote packages) in
696189
@@ -127,6 +127,6 @@ let uninstall_command packages package_management =
696189
   | "zypper" -> sprintf "zypper -n rm %s" quoted_args
696189
 
696189
   | "unknown" ->
696189
-    error_unknown_package_manager (s_"--uninstall")
696189
+    error_unknown_package_manager "--uninstall"
696189
   | pm ->
696189
-    error_unimplemented_package_manager (s_"--uninstall") pm
696189
+    error_unimplemented_package_manager "--uninstall" pm
696189
diff --git a/common/mltools/on_exit.ml b/common/mltools/on_exit.ml
696189
index 53ccb68a..cae12e73 100644
696189
--- a/common/mltools/on_exit.ml
696189
+++ b/common/mltools/on_exit.ml
696189
@@ -52,7 +52,7 @@ let do_actions () =
696189
     List.iter (do_action (fun file -> Unix.unlink file)) !files;
696189
     List.iter (do_action (
696189
       fun dir ->
696189
-        let cmd = sprintf "rm -rf %s" (Filename.quote dir) in
696189
+        let cmd = sprintf "rm -rf -- %s" (Filename.quote dir) in
696189
         ignore (Tools_utils.shell_command cmd)
696189
       )
696189
     ) !rmdirs;
696189
@@ -102,7 +102,7 @@ let unlink filename =
696189
   register ();
696189
   List.push_front filename files
696189
 
696189
-let rmdir dir =
696189
+let rm_rf dir =
696189
   register ();
696189
   List.push_front dir rmdirs
696189
 
696189
diff --git a/common/mltools/on_exit.mli b/common/mltools/on_exit.mli
696189
index a02e3db3..9bcf104f 100644
696189
--- a/common/mltools/on_exit.mli
696189
+++ b/common/mltools/on_exit.mli
696189
@@ -47,7 +47,7 @@ val f : (unit -> unit) -> unit
696189
 val unlink : string -> unit
696189
 (** Unlink a single temporary file on exit. *)
696189
 
696189
-val rmdir : string -> unit
696189
+val rm_rf : string -> unit
696189
 (** Recursively remove a temporary directory on exit (using [rm -rf]). *)
696189
 
696189
 val kill : ?signal:int -> int -> unit
696189
diff --git a/input/OVA.ml b/input/OVA.ml
696189
index 9e9c3712..09ceee98 100644
696189
--- a/input/OVA.ml
696189
+++ b/input/OVA.ml
696189
@@ -78,7 +78,7 @@ let rec parse_ova ova =
696189
     else (
696189
       let tmpdir =
696189
         let t = Mkdtemp.temp_dir ~base_dir:large_tmpdir "ova." in
696189
-        On_exit.rmdir t;
696189
+        On_exit.rm_rf t;
696189
         t in
696189
 
696189
       match detect_file_type ova with
696189
diff --git a/input/parse_domain_from_vmx.ml b/input/parse_domain_from_vmx.ml
696189
index 947ca414..7aca2c24 100644
696189
--- a/input/parse_domain_from_vmx.ml
696189
+++ b/input/parse_domain_from_vmx.ml
696189
@@ -375,7 +375,7 @@ and find_nics vmx =
696189
 let parse_domain_from_vmx vmx_source =
696189
   let tmpdir =
696189
     let t = Mkdtemp.temp_dir "vmx." in
696189
-    On_exit.rmdir t;
696189
+    On_exit.rm_rf t;
696189
     t in
696189
 
696189
   (* If the transport is SSH, fetch the file from remote, else
696189
diff --git a/lib/nbdkit.ml b/lib/nbdkit.ml
696189
index 07896684..1137b6bb 100644
696189
--- a/lib/nbdkit.ml
696189
+++ b/lib/nbdkit.ml
696189
@@ -105,7 +105,7 @@ let add_filter_if_available cmd filter =
696189
 let run_unix socket cmd =
696189
   (* Create a temporary directory where we place the PID file. *)
696189
   let piddir = Mkdtemp.temp_dir "v2vnbdkit." in
696189
-  On_exit.rmdir piddir;
696189
+  On_exit.rm_rf piddir;
696189
 
696189
   let id = unique () in
696189
   let pidfile = piddir // sprintf "nbdkit%d.pid" id in
696189
diff --git a/lib/qemuNBD.ml b/lib/qemuNBD.ml
696189
index bbb65f41..c3dd1666 100644
696189
--- a/lib/qemuNBD.ml
696189
+++ b/lib/qemuNBD.ml
696189
@@ -69,7 +69,7 @@ let run_unix socket { disk; snapshot; format; imgopts } =
696189
 
696189
   (* Create a temporary directory where we place the PID file. *)
696189
   let piddir = Mkdtemp.temp_dir "v2vqemunbd." in
696189
-  On_exit.rmdir piddir;
696189
+  On_exit.rm_rf piddir;
696189
 
696189
   let id = unique () in
696189
   let pidfile = piddir // sprintf "qemunbd%d.pid" id in
696189
diff --git a/lib/utils.ml b/lib/utils.ml
696189
index 7116a4f9..84b9a93f 100644
696189
--- a/lib/utils.ml
696189
+++ b/lib/utils.ml
696189
@@ -204,7 +204,7 @@ let error_if_no_ssh_agent () =
696189
 let create_v2v_directory () =
696189
   let d = Mkdtemp.temp_dir "v2v." in
696189
   chown_for_libvirt_rhbz_1045069 d;
696189
-  On_exit.rmdir d;
696189
+  On_exit.rm_rf d;
696189
   d
696189
 
696189
 (* Wait for a file to appear until a timeout. *)
696189
diff --git a/output/python_script.ml b/output/python_script.ml
696189
index 54ccd1b5..ecf46c2d 100644
696189
--- a/output/python_script.ml
696189
+++ b/output/python_script.ml
696189
@@ -33,7 +33,7 @@ type script = {
696189
 
696189
 let create ?(name = "script.py") code =
696189
   let tmpdir = Mkdtemp.temp_dir "v2v." in
696189
-  On_exit.rmdir tmpdir;
696189
+  On_exit.rm_rf tmpdir;
696189
   let path = tmpdir // name in
696189
   with_open_out path (fun chan -> output_string chan code);
696189
   { tmpdir; path }