[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if
From: |
Linda Walsh |
Subject: |
bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not |
Date: |
Sat, 26 Oct 2013 20:48:15 -0700 |
User-agent: |
Thunderbird |
I was trying to update a copy of /var (=>/root2/var).
It issues non-fatal, failure messages when copying from or to
a non-dir entry to a dir entry.
I tried -a to force the removal of the target dir, or target file.
It didn't work.
I tried --remove-destination, which is clearly not "file" specific
(i.e. should remove dir), it didn't work either.
The problem doesn't happen with pipes or sockets overwriting
files or any combo... seems just dirs are a problem.
mkdir a
touch a/file2dir
mkdir a/dir2file
cp -a a b
mv a/file2dir a/x
mv a/dir2file a/file2dir
mv a/x a/dir2file
---
state=
ll a b
a:
total 0
-rw-rw-r-- 1 0 Oct 26 20:37 dir2file
drwxrwxr-x 2 6 Oct 26 20:37 file2dir/
b:
total 0
drwxrwxr-x 2 6 Oct 26 20:37 dir2file/
-rw-rw-r-- 1 0 Oct 26 20:37 file2dir
now try copying new changes from 'a' to 'b' -- can't do it.
cp -a a/. b/.
cp: cannot overwrite non-directory ‘b/././file2dir’ with directory
‘a/./file2dir’
cp: cannot overwrite directory ‘b/././dir2file’ with non-directory
-a/--archive is suppose to duplicate *types* on the target -- it should
be able to make either change without --force or pre-removal,
HOWEVER,
I'd suggest
1) allowing directories to overwrite files as that seems reasonable...t
and
2) with either -f OR --remove-destination, a file would overwrite a directory
(dir removed).
2b) One might argue that with -f, where dest is a file the failure comes first,
aborting a try
for removal; however, certainly, with --remove-destination, the destination
(whatever it is)
should be removed 1st and no error should be occurring.
Version: (on suse linux)...
cp (GNU coreutils) 8.21 - Copyright (C) 2013
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not,
Linda Walsh <=
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Pádraig Brady, 2013/10/27
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Linda Walsh, 2013/10/28
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Bernhard Voelker, 2013/10/28
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Linda Walsh, 2013/10/28
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Bernhard Voelker, 2013/10/29
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Philipp Thomas, 2013/10/29
- bug#15727: Bug: cp <-a|-archive> (w/<-f|--remove-destination>) breaks if one of files is a dir and other not, Linda Walsh, 2013/10/29