bug-coreutils
[Top][All Lists]
Advanced

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

cp -al won't overwrite existing files


From: Zak
Subject: cp -al won't overwrite existing files
Date: Sun, 3 Dec 2006 15:57:49 +0000

Hi (again),

cp -al won't overwrite existing files with hardlinks to the source version. Quoth the online info(1) page for cp in coreutils (the bit about --force):
Contrast this behavior with that enabled by --link and --symbolic- link, whereby the destination file is never opened but rather is unlinked unconditionally.

But this doesn't seem to be the case unless I use --force:
laptop:~/cptest zak$ rm -rf *
laptop:~/cptest zak$ mkdir src dest
laptop:~/cptest zak$ touch src/a dest/a
laptop:~/cptest zak$ ls -i src/a dest/a
524454 dest/a   524453 src/a
laptop:~/cptest zak$ ~/coreutils/coreutils-6.6/src/cp -al src/a dest/a
/Users/zak/coreutils/coreutils-6.6/src/cp: cannot create link `dest/ a': File exists
laptop:~/cptest zak$ ls -i src/a dest/a
524454 dest/a   524453 src/a
laptop:~/cptest zak$ ~/coreutils/coreutils-6.6/src/cp -al --force src/a dest/a
laptop:~/cptest zak$ ls -i src/a dest/a
524453 dest/a   524453 src/a

I'd like cp to behave like the info page says. Is this a bug in cp or the docs?

Cheers,

Zak




reply via email to

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