supermin/0003-Use-external-command-mv-to-rename-old-output-directo.patch
Richard W.M. Jones 29afe98686 Add further patch to fix symlinks (RHBZ#1770304).
Add all patches since 5.1.20 was released.
2019-12-10 18:49:01 +00:00

39 lines
1.2 KiB
Diff

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