Re: ln "" foo gives misleading error message

Bob Proulx <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Andreas Schwab wrote:
> IMHO it is a kernel bug to give an error here.  The symlink target shall
> not be parsed at symlink creation, and POSIX does not place any
> restriction on it apart from the maximum length.

Agreed.  So far I can't think of any reason not to allow an empty
string there.  Seems like a kernel bug.

> An empty name never resolves to a file, so any attempt to follow this
> symlink should fail with ENOENT (but not the symlink creation).
> 
> > Perhaps the kernel authors were simply avoiding that question of
> > defining what to do with a zero length value for the symlink.
> > Allowing it may open more problems than they wanted to deal with and
> > simply using ENOENT perhaps the simplest error to return in that case.
> 
> Since the symlink target needs to be parsed every time the link is
> followed I don't see how this can create more problems.

After some thinking I agree with you.  It would be just the same as if
an empty string were given for the original file.

Seems like a Linux kernel bug.

Bob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.