Re: PATCH against 2.1.72: better symlinks for a better future (was Re: security warning)

Kevin Buhr (buhr@stat.wisc.edu)
17 Dec 1997 14:21:57 -0600


mlord <mlord@pobox.com> writes:
>
> What happens when the symlink has a trailing slash in its name,
> as opposed to me entering one on the command line?
>
>
> eg. ln -s foo/ foo-symlink
> instead of ln -s foo foo-symlink
>
> This happens a *lot*.

The first argument to a "symlink" system call is handled through a
different mechanism, so both:

ln -s foo/ slash
ln -s foo noslash

will work irrespective of the proposed changes. On an ext2
filesystem, they create slightly different symlinks:

total 0
lrwxrwxrwx 1 buhr buhr 3 Dec 17 12:58 noslash -> foo
lrwxrwxrwx 1 buhr buhr 4 Dec 17 12:58 slash -> foo/

However, in practice, this doesn't make a difference. Whether "foo"
is a regular file, a directory, or another symlink (dangling or not),
"noslash" and "slash" appear to behave the same in all cases (except,
of course, if you use an explicit "readlink" call).

Kevin <buhr@stat.wisc.edu>