On Monday 03 November 2003 23:08, Paul Eggert wrote:
> Stefanos Harhalakis <address@hidden> writes:
> > I believe that it should have an option to compare
> > source and destination files before replacing the destination.
>
> I like the basic idea, and have been using a wrapper like yours for many
> years. But doesn't the implementation have to be more complicated than
> that?
>
> For example, suppose the destination already exists, and has the proper
> contents, but has the wrong ownership? Or suppose the destination
> is supposed to be stripped? Or a backup was supposed to be made? Etc.
I believe you're right... I don't know about coreutils internals but I just
took a quick look at copy.c. As far as I understand, copy() is an
one-for-everything function.
Perhaps copy_internal() should be changed. As far as i can see, copy_reg()
does the real copy so this is the function that should be avoided, so the
check should be done just before calling copy_reg(). This way you're always
sure about keeping backups etc etc.. The only catch is that another flag
should be added to cp_options.
Strip is not a problem since it will be run no matter if copy() realy copyied
the file or not..
<<V13>>