Re: ln "" foo gives misleading error message

Andreas Schwab <[email protected]>
Newsgroups gmane.comp.gnu.utils.bugs
Message-ID <[email protected]>
Bob Proulx <[email protected]> writes:

> That error message comes from the kernel.  I agree that it isn't
> really correct.  But if that is to be improved it would need to be the
> kernel that would need to improve it.

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.

> On first thought I think it should be allowed.  Although it is an
> unusual use to store nothing there.  How would that be interpreted as
> a file?  Would it be the same as "."?

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.

Andreas.

-- 
Andreas Schwab, [email protected]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
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.