[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bad cp -a behaviour
From: |
Jim Meyering |
Subject: |
Re: Bad cp -a behaviour |
Date: |
Sun, 10 Oct 2004 22:41:51 +0200 |
Paul Eggert <address@hidden> 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.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Bad cp -a behaviour,
Jim Meyering <=