Paul Eggert <[EMAIL PROTECTED]> wrote:
...
> The GNU documentation says that "-a" implies "--preserve=links" and
> that "--preserve-links" means "Preserve in the destination files any
> links between corresponding source files."  Here, Tim wants "cp -a"
> to preserve in the destination the fact that the source files are
> different, even though they are already hard links in the destination.
>
> This sounds reasonable to me, so I installed the following patch.  But
> I'd like someone with sharp eyes (Jim? :-) to double-check it.

Thanks.  That looks fine.
(belatedly :-)

> In particular, I don't understand what these lines are doing in the
> existing code:
>
>                      || (x->dereference == DEREF_NEVER
>                          && ! S_ISREG (src_sb.st_mode))))
>
> Why should the behavior differ here merely because the source
> is (say) a character special file?

It has to be different at least when the source file is a symlink
and when cp is preserving this particular one.  If it didn't remove such
an existing destination file, the subsequent symlink call would fail.
As to why it's not simply `S_ISLNK (...', i.e.,

                       || (x->dereference == DEREF_NEVER
                           && S_ISLNK (src_sb.st_mode))))

I don't know off hand.  The tests do pass with that change,
so I'll probably check it in.


_______________________________________________
Bug-coreutils mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to