[PATCH] adding two new options to 'cp'
Rick C. Petty
rick-freebsd at kiwi-computer.com
Mon Jul 31 21:31:11 UTC 2006
On Mon, Jul 31, 2006 at 11:01:24PM +0200, Ivan Voras wrote:
> Rick C. Petty wrote:
> >"-l" may be a useful option, but at what point is the line drawn between
> >bloating our base cp and having a gcp port (or using linux_base)??
> It's like saying "if you need this option, go to Linux" - it just seems
Not quite. I'm just saying that the "-l" option would be seldomly-used and
chances are that the people who would use it are likely to also have
> With all respect to "series of small utilities" way of doing things, I
> think the "whatever is shorter to type" takes precedence :)
Ah, so then let's install a binary called "a" which is hard-linked to cp
and does the equivalent of "cp -a". While we're at it, let's add a "t"
command as a shortcut to "tar -f". [/sarcasm]
This is what aliases are for. "cp -a" seems to me to be a silly way to
say "cp -pR". Come on, it's only one letter shorter (although you could
argue the time it takes to hit the shift key counts as a letter). I would
think that more BSD admins are so used to typing "cp -pR" than "cp -a". In
any case, it seems pointless to waste a letter when an alias is a more
appropriate solution. cp(1) uses getopt(3), so there are only so many
letters available. It seems more useful to add other bits of functionality
and use up letters. If you really want "-a" then it should copy sparse
files correctly, preserve hard links within the copied hierarchy (much like
rsync's -H option), and handle extended attributes (e.g. ACLs). If not,
then save "-a" for something like ACLs. Does cp(1) properly handle ACLs
> And it's not like the added code will have to be changed/maintained in
> the forseeable future - if the basic implementation is ok, the
> underlying structures and ideas will not change while UFS semantics are
> in use.
Actually I have no gripe against "-l"; I was just making a point. I think
this hard-link idea is pretty useful.
-- Rick C. Petty
More information about the freebsd-hackers