GNU bug report logs -
#10686
mv: moving hardlink of a softlink to the softlink does nothing
Previous Next
Full log
Message #41 received at 10686 <at> debbugs.gnu.org (full text, mbox):
On 02/07/2012 11:45 AM, Michael Felt wrote:
> Just reading - for reference only - AIX 5.3, and I expect new versions behave as follows
> (second link becomes a hardlink to original file, mv "removes" one hard link, i.e. original file (as inode) remains.
>
> root <at> x105:[/tmp/test]touch f
> root <at> x105:[/tmp/test]ln -s f l
> root <at> x105:[/tmp/test]ls -l
> total 0
> -rw-r--r-- 1 root system 0 2012-02-07 11:41 f
> lrwxrwxrwx 1 root system 1 2012-02-07 11:41 l -> f
> root <at> x105:[/tmp/test]ln l s
> root <at> x105:[/tmp/test]ls -ogi
> total 0
> 239 -rw-r--r-- 2 0 2012-02-07 11:41 f
> 240 lrwxrwxrwx 1 1 2012-02-07 11:41 l -> f
> 239 -rw-r--r-- 2 0 2012-02-07 11:41 s
> root <at> x105:[/tmp/test]mv s f
> root <at> x105:[/tmp/test]ls -ogi
> total 0
> 239 -rw-r--r-- 1 0 2012-02-07 11:41 f
> 240 lrwxrwxrwx 1 1 2012-02-07 11:41 l -> f
Hi Michael,
the result is the same, but there's a little difference here:
your ln does not create a hardlink to the symlink, but
rather a hardlink to the symlink's *target*.
On Linux, the situation before mv looks like this:
$ touch f && ln -s f l && ln l s && ls -ogi
total 0
11279 -rw-r--r-- 1 0 Feb 7 13:17 f
11280 lrwxrwxrwx 2 1 Feb 7 13:17 l -> f
11280 lrwxrwxrwx 2 1 Feb 7 13:17 s -> f
Before Jim's patch, mv didn't remove the source, i.e. 's':
$ /bin/mv s l ; ls -ogi
total 0
11279 -rw-r--r-- 1 0 Feb 7 13:17 f
11280 lrwxrwxrwx 2 1 Feb 7 13:17 l -> f
11280 lrwxrwxrwx 2 1 Feb 7 13:17 s -> f
Now, mv correctly unlinks 's':
$ ~/git/coreutils/src/mv s l ; ls -ogi
total 0
11279 -rw-r--r-- 1 0 Feb 7 13:17 f
11280 lrwxrwxrwx 1 1 Feb 7 13:17 l -> f
Regarding your case, there's no change.
Have a nice day,
Berny
This bug report was last modified 6 years and 270 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.