Perhaps this is overkill, but how about the attached followup patch for that
gzexe problem with filesystems that do not support symlinks? The idea is to use
a variant of Bruno's suggestion that the file should always exist.
>From c1065f84b242c9c46f08970ebb1df7edb567f149 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 23 Nov 2017 22:23:03 -0800
Subject: [PATCH] gzexe: ensure file always exists
* gzexe.in: When in a filesystem that does not support symlinks,
use rm+cp rather than mv to make backups, so that the argument
file always exists.
---
gzexe.in | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gzexe.in b/gzexe.in
index 721aba4..65b2de2 100644
--- a/gzexe.in
+++ b/gzexe.in
@@ -213,7 +213,10 @@ EOF
printf >&2 '%s\n' "$0: $tmp: cannot chmod"
continue
}
- ln -f "$file" "$file~" 2>/dev/null || mv -f "$file" "$file~" || {
+ ln -f "$file" "$file~" 2>/dev/null || {
+ # Hard links may not work. Fall back on rm+cp so that $file always exists.
+ rm -f "$file~" && cp -p "$file" "$file~"
+ } || {
res=$?
printf >&2 '%s\n' "$0: cannot backup $i as $i~"
continue
--
2.14.3