tech-userlevel archive

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

Re: cp -n diff

On Tue, 3 May 2011 20:30:35 +0200, Zafer Aydoğan wrote:
attached is a patch that implements the -n option for cp, which skips
files on the target.
This is useful if you want copy two directories and want only the
non-existing/new files to be be copied.
This has also been implemented in FreeBSD as cp -n, in Linux its named
-u for update.
I have followed the FreeBSD implementation.
The patch is easy and straightforward. It is against current.
I would like to commit it.
Please have a look.

Any comments ?

Please Zafer, don't. I know GNUists (and to some extent FreeBSD) attitude regularly push towards feature creep; I would like NetBSD to avoid going down that a route.

Duplicity of options contradicts simplicity; especially in this case, where the option is not standardized across different operating systems, and that situation may ultimately lead to more and more divergence (you can't know this in advance). People will start being lost. Assume that one guy is accustomed to FreeBSD functionality, starts using cp(1) in the very same way under GNU, and expects same behavior. Too bad, plurality of options has made this non-deterministic on the long run. I would prefer to see cp(1) erroring out with "unkown option." rather than ending with "unknown behavior."

Besides, I would oppose turning cp(1) in a full fledged backup tool as GNU coreutils have done. It's neither meant for that ("backups" are not plain blunt copies, backups encompasses more than that: journaling, integrity checks, following restore processes...) nor sane from a design PoV. It reflects mono-cultural thinking, aka "when all you have is a hammer, everything looks like a nail." Use the right tool for the job.

Given all this rhetoric stuff, let's conclude with a quote: perfection is achieved not when there is nothing more to add, but when there is nothing left to remove (approximative translation from french).

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index