Blame SOURCES/0001-Use-external-command-mv-to-rename-old-output-directo.patch

8c9c3f
From 6579cf5f72d5de345ae1cc97d0344dfa1771460a Mon Sep 17 00:00:00 2001
8c9c3f
From: "Richard W.M. Jones" <rjones@redhat.com>
8c9c3f
Date: Mon, 28 Jan 2019 22:20:33 +0000
8c9c3f
Subject: [PATCH] Use external command mv to rename old output directory
8c9c3f
 (RHBZ#1670191).
8c9c3f
8c9c3f
See https://bugzilla.redhat.com/show_bug.cgi?id=1670191#c0
8c9c3f
for explanation.
8c9c3f
8c9c3f
Thanks: Sam Eiderman
8c9c3f
---
8c9c3f
 src/supermin.ml | 10 ++++------
8c9c3f
 1 file changed, 4 insertions(+), 6 deletions(-)
8c9c3f
8c9c3f
diff --git a/src/supermin.ml b/src/supermin.ml
8c9c3f
index 71d8b64..7c7135b3 100644
8c9c3f
--- a/src/supermin.ml
8c9c3f
+++ b/src/supermin.ml
8c9c3f
@@ -264,12 +264,10 @@ appliance automatically.
8c9c3f
 
8c9c3f
   (* Delete the old output directory if it exists. *)
8c9c3f
   let old_outputdir =
8c9c3f
-    try
8c9c3f
-      let old_outputdir = outputdir ^ "." ^ string_random8 () in
8c9c3f
-      rename outputdir old_outputdir;
8c9c3f
-      Some old_outputdir
8c9c3f
-    with
8c9c3f
-      Unix_error _ -> None in
8c9c3f
+    let old_outputdir = outputdir ^ "." ^ string_random8 () in
8c9c3f
+    let cmd = sprintf "mv %s %s 2>/dev/null"
8c9c3f
+                      (quote outputdir) (quote old_outputdir) in
8c9c3f
+    if Sys.command cmd == 0 then Some old_outputdir else None in
8c9c3f
 
8c9c3f
   if debug >= 1 then
8c9c3f
     printf "supermin: renaming %s to %s\n%!" new_outputdir outputdir;
8c9c3f
-- 
8c9c3f
2.22.0
8c9c3f