bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ln "" foo gives misleading error message


From: Andreas Schwab
Subject: Re: ln "" foo gives misleading error message
Date: Tue, 15 Jan 2013 10:25:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.92 (gnu/linux)

Bob Proulx <address@hidden> 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, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]