Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jun 2001 10:04:43 -0700
From:      Bakul Shah <bakul@bitblocks.com>
To:        Bruce Evans <bde@zeta.org.au>
Cc:        current@FreeBSD.ORG, Matt Dillon <dillon@earth.backplane.com>
Subject:   Re: Ok, try this patch. (was Re: symlink(2) [Was: Re: tcsh.cat]) 
Message-ID:  <200106181704.NAA12227@renown.cnchost.com>
In-Reply-To: Your message of "Mon, 18 Jun 2001 15:40:23 %2B1000." <Pine.BSF.4.21.0106181454450.6291-100000@besplex.bde.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> NetBSD committed essentially this patch 4 years ago (as part of rev.1.23).
> I like it, except it seems to be incompatible with POSIX.1-200x.

> The bug that stat(2) on a null symlink classifies the target of the symlink
> as a directory is caused by resolving the pathname to "" and then not
> returning ENOENT in namei().  "" tends to be interpreted as "." unless
> it is specially disallowed, and that's what happens here.  "" is only
> disallowed for the unresolved pathname.  Since the bug is in namei(), it
> affects all syscalls that deal with pathnames.  E.g., you can open()
> null symlinks; this is equivalent to opening ".".

Err... not quite.  Given a path like
    <prefix>/<symlink><suffix>
after the substitution of <symlink> with its target, the
search must start at the root if <symlink> target starts with
a "/".  So it seems to me the _use_ of a "" target symlink
(in all but the final path component position) is exactly
equivalent to the use of a "/" target symlink.  When used in
the final path component position, you get either the symlink
or ENOENT.  The POSIX excerpt Garrett quoted seems to match
this.

This is surprising at first but hardly worth adding a
singularity (an exception).  So IMHO for a "" target symlink
used in _any place other than the final component_ it should
be treated as if it points to just "/".  Matt Dillon's patch
seems to return ENOENT regardless of how a "" target symlink
is used.

This is not a big deal but I care about not having
unnecessary exceptions.

[Yes, I have read through this thread]

-- bakul

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106181704.NAA12227>