ls -s and relative pathnames

utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!harpo!eagle!allegra!linus!genrad!mit-eddi!mp utzoo!decvax!decwrl!sun!megatest!fortune!hpda!hplabs!hao!seismo!harpo!eagle!allegra!linus!genrad!mit-eddi!mp
Tue May 10 18:49:22 AEST 1983


There is a problem with "ln -s" on 4.1c (and presumably 4.1a).  Suppose
/usr/src/usr.bin/cal.c exists, and /usr/mp is empty.  If I cd to
/usr/src/usr.bin and do "ln -s cal.c /usr/mp/cal.c", then /usr/mp/cal.c
is a link to simply "cal.c".  The fact that I was connected to
/usr/src/usr.bin when I made the link is not recorded.  This means that
/usr/mp/cal.c points to itself.

The problem is that it's making a link to a relative pathname rather
than an absolute pathname.  It could be worse, though - think of what
problems there would be if open("/usr/mp/cal.c", m) meant "open
whatever cal.c happens to be in the current working directory".

It's difficult to do the right thing here, unless ln has a way of
getting the absolute pathname of the user's connected directory at the
time the link is made.

	Mark (genrad!mit-eddie!mp, eagle!mit-vax!mp)



More information about the Comp.bugs.4bsd.ucb-fixes mailing list