[PATCH] adding two new options to 'cp'
Mike Meyer
mwm-keyword-freebsdhackers2.e313df at mired.org
Tue Aug 1 18:26:42 UTC 2006
In <20060801171150.GB3413 at megan.kiwi-computer.com>, Rick C. Petty <rick-freebsd at kiwi-computer.com> typed:
> On Tue, Aug 01, 2006 at 05:26:11PM +1000, Peter Jeremy wrote:
> > On Mon, 2006-Jul-31 22:42:49 +0200, Ivan Voras wrote:
> > >I agree with this, and while you're in there, can you add -s to copy
> > >sparse files (via the usual "if the buffer is all nulls, seek beyond eof
> > >instead of writing" trick)?
> >
> > Note that it isn's possible to accurately distinguish between a block
> > of NULs and a hole in the file through the filesystem. The only way
> > to accurately copy a sparse file is with dump/restore.
>
> Sure it is-- in a number of ways. The most useful way is to do something
> of the sort:
[code elided]
> Obviously, I didn't add the error checking/handling, but AFAIK this is
> essentially what the -S option to gnu's tar does.
Yes, but gnu tar doesn't do this accurately, so you're not doing what
Peter said you couldn't do. You are doing what Ivan asked, though.
I always think of cp as a tool for making *copies of files*, not for
creating an archive of a directory tree. We've got lots of tools that
do the latter. Do we really need another one?
<mike
--
Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.
More information about the freebsd-hackers
mailing list