Subject: Re: bin/920: ls -l displays incorrect mtime for symbolic links
To: Jim Wight <J.K.Wight@newcastle.ac.uk>
From: Wayne Berke <berke@panix.com>
List: netbsd-bugs
Date: 03/29/1995 08:27:04
In message <199503290935.BAA16682@sun-lamp.cs.berkeley.edu>, Jim Wight writes:
> 
> >Number:         920
> >Category:       bin
> >Synopsis:       ls -l displays incorrect mtime for symbolic links

[...]

> >Description:
>     In long format ls displays the modification time of the most recently
>     modified file for all symbolic links rather than each's individual
>     modification time.
> 
> >How-To-Repeat:
>     $ ln -s /bin/sh sh1
>     $ ls -l
>     total 0
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:28 sh1 -> /bin/sh
>     $ ln -s /bin/sh sh2
>     $ ls -l
>     total 0
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:29 sh1 -> /bin/sh
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:29 sh2 -> /bin/sh
>     $ >junk
>     $ ls -l
>     total 0
>     -rw-r--r--  1 njkw  wheel  0 Mar 27 22:30 junk
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:30 sh1 -> /bin/sh
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:30 sh2 -> /bin/sh
>     $ ln -s /bin/sh sh3
>     $ ls -l
>     total 0
>     -rw-r--r--  1 njkw  wheel  0 Mar 27 22:30 junk
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:31 sh1 -> /bin/sh
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:31 sh2 -> /bin/sh
>     lrwxrwxrwt  1 root  wheel  7 Mar 27 22:31 sh3 -> /bin/sh
>     $
> 
>     Note how the times associated with the symbolic links keep shifting as
>     new files are created.

It's actually worse.  It seems that all symbolic links from the same directory
have their mtimes and ctimes linked even when they point to different
files:

chipster% cd /tmp
chipster% ln -s /bin/cat cat1
chipster% ls -l *1 
lrwxrwxrwt  1 root  wheel  8 Mar 29 08:19 cat1 -> /bin/cat
chipster% ls -lc *1
lrwxrwxrwt  1 root  wheel  8 Mar 29 08:19 cat1 -> /bin/cat
chipster% date
Wed Mar 29 08:21:00 EST 1995
chipster% ln -s /bin/sh sh1
chipster% ls -l *1
lrwxrwxrwt  1 root  wheel  8 Mar 29 08:21 cat1 -> /bin/cat
lrwxrwxrwt  1 root  wheel  7 Mar 29 08:21 sh1 -> /bin/sh
chipster% ls -lc *1
lrwxrwxrwt  1 root  wheel  8 Mar 29 08:21 cat1 -> /bin/cat
lrwxrwxrwt  1 root  wheel  7 Mar 29 08:21 sh1 -> /bin/sh
chipster%

Also, note that the owner of the slink is also wrong and prevents you
from deleting the file.