GNU bug report logs -
#6960
mv refuses to move a symlink over a hard link to the same file
Previous Next
Full log
View this message in rfc822 format
On 01/30/2012 03:41 AM, Jim Meyering wrote:
> /* At this point, it is normally an error (data loss) to move a symlink
> onto its referent, but in at least one narrow case, it is not:
> In move mode, when
> 1) src is a symlink,
> 2) dest is not a symlink,
> 3) dest has a link count of 2 or more and
> 4) dest and the referent of src are not the same entry,
> then it's ok, since while we'll lose one of those hard links,
> src will still point to a remaining link.
> Note that technically, condition #4 obviates condition #2, but we
> retain the 1 < st_nlink condition because that means fewer invocations
> of the more expensive #4.
The last 3 lines are confusing.
Don't you mean "condition #3" and not "condition #2"?
The last 2 lines talk about condition 3, not condition 2.
Come to think of it, why is condition 2 needed at all?
Can't we eliminate it, both in the commentary and in the code?
If a symlink has a link count greater than 1, then overwriting
it won't lose the link; in that sense it's just like a regular
file with a link count greater than 1. So why are symlinks
special there?
This bug report was last modified 13 years and 179 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.