bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#29266: gzip-1.8.41 test results: help-version and hard links


From: Bruno Haible
Subject: bug#29266: gzip-1.8.41 test results: help-version and hard links
Date: Thu, 16 Nov 2017 11:37:31 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-98-generic; KDE/5.18.0; x86_64; ; )

Paul Eggert wrote:
> > +  ln -f "$file" "$file~" 2>/dev/null || cp -f "$file" "$file~" || {
> 
> This will be problematic if the destination already exists, as the 
> resulting permissions etc. may not be what the user intend. How about if 
> we fall back on "mv -f" instead? Although this has the disadvantage of 
> having a small window where "$file" does not exist, I think that's 
> preferable to the disadvantage of using "cp".

How about

  ln -f "$file" "$file~" 2>/dev/null || { rm -f "$file~" && cp "$file" 
"$file~"; } || {

then? It fixes the problem "if the destination already exists", and does
NOT leave a window where "$file" does not exist.

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]