[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10686: mv: moving hardlink of a softlink to the softlink does nothin
From: |
Bernhard Voelker |
Subject: |
bug#10686: mv: moving hardlink of a softlink to the softlink does nothing |
Date: |
Tue, 07 Feb 2012 13:26:09 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111220 Thunderbird/9.0 |
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.
>
> address@hidden:[/tmp/test]touch f
> address@hidden:[/tmp/test]ln -s f l
> address@hidden:[/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
> address@hidden:[/tmp/test]ln l s
> address@hidden:[/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
> address@hidden:[/tmp/test]mv s f
> address@hidden:[/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