bug-coreutils
[Top][All Lists]
Advanced

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

bug#55029: Simple backup swaps source and destination files


From: Steve Ward
Subject: bug#55029: Simple backup swaps source and destination files
Date: Tue, 19 Apr 2022 19:05:09 -0400

When doing mv or cp with --backup=simple, if an existing file in
DIRECTORY has the same name as SOURCE, the files appear to be swapped
instead of an in-place backup of the original file in DIRECTORY being
made.
It doesn't happen with --backup=numbered.  SIMPLE_BACKUP_SUFFIX is not set.

Steps to reproduce:

$ mkdir tmp
$ echo "first file" > tmp/a
$ echo "second file" > a
$ command mv -v --backup=simple a tmp/
renamed 'a' -> 'tmp/a' (backup: 'tmp/a~')

$ cat tmp/a~
cat: tmp/a~: No such file or directory

$ cat a~
first file

Version info:

$ mv --version | head -n 1
mv (GNU coreutils) 9.1

$ uname -srm
Linux 5.17.3-arch1-1 x86_64

$ ldd --version | head -n 1
ldd (GNU libc) 2.35

The filesystem type is ext4.





reply via email to

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