From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Ken Irving Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 08:32:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 13447@debbugs.gnu.org X-Debbugs-Original-To: bug-coreutils@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.135823867017274 (code B ref -1); Tue, 15 Jan 2013 08:32:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Jan 2013 08:31:10 +0000 Received: from localhost ([127.0.0.1]:60853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv1vK-0004UY-1B for submit@debbugs.gnu.org; Tue, 15 Jan 2013 03:31:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58792) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv1oK-0004Ia-0x for submit@debbugs.gnu.org; Tue, 15 Jan 2013 03:23:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tv1np-0007EB-7l for submit@debbugs.gnu.org; Tue, 15 Jan 2013 03:23:27 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:37384) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv1np-0007E7-4w for submit@debbugs.gnu.org; Tue, 15 Jan 2013 03:23:25 -0500 Received: from eggs.gnu.org ([208.118.235.92]:41903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv1nl-0007g8-Cl for bug-coreutils@gnu.org; Tue, 15 Jan 2013 03:23:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tv1nj-0007DA-0i for bug-coreutils@gnu.org; Tue, 15 Jan 2013 03:23:21 -0500 Received: from sidik.uaf.edu ([137.229.5.242]:57367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tv1ni-0007D4-MP for bug-coreutils@gnu.org; Tue, 15 Jan 2013 03:23:18 -0500 Received: from localhost (hayes.engr.uaf.edu [137.229.33.196]) by sidik.uaf.edu (8.13.8/8.13.8/uaf3) with ESMTP id r0F8NGAv021704 for ; Mon, 14 Jan 2013 23:23:16 -0900 Received: from ken by localhost with local (Exim 4.71) (envelope-from ) id 1Tv1nc-0002Im-Sv for bug-coreutils@gnu.org; Mon, 14 Jan 2013 23:23:13 -0900 Date: Mon, 14 Jan 2013 23:23:12 -0900 From: Ken Irving Message-ID: <20130115082312.GA7218@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 208.118.235.17 X-Spam-Score: -4.2 (----) X-Mailman-Approved-At: Tue, 15 Jan 2013 03:31:09 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) (Previously sent in error to the bug-gnu-utils list.) I've been using symbolic links in a non-file-related way, e.g., to store arbitrary string values, but find that if I try to create a symlink with an empty 'target' name, e.g., as 'ln -s "" foo', the error message emitted is not really correct. $ ln -s "" foo ln: creating symbolic link `foo' -> `': No such file or directory $ ln -sf "" foo ln: creating symbolic link `foo' -> `': No such file or directory A link can be created when no file or directory exists, e.g., $ stat x || ln -s x foo && echo ok stat: cannot stat `x': No such file or directory ok so it seems that 'No such file or directory' must not be the actual reason for the failure. Perhaps something like 'null target name' would be more accurate? I only happened upon this in working on a test script, and have no expectation for the operation to succeed. Thanks Ken Irving From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:18:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Ken Irving Cc: 13447@debbugs.gnu.org Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824142521403 (code B ref 13447); Tue, 15 Jan 2013 09:18:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:17:05 +0000 Received: from localhost ([127.0.0.1]:60887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2dk-0005Z7-N1 for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:17:05 -0500 Received: from joseki.proulx.com ([216.17.153.58]:60997) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2dh-0005Ya-QX; Tue, 15 Jan 2013 04:17:03 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 26C51211D5; Tue, 15 Jan 2013 02:16:32 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id BA6162DCDC; Tue, 15 Jan 2013 02:16:31 -0700 (MST) Date: Tue, 15 Jan 2013 02:16:31 -0700 From: Bob Proulx Message-ID: <20130115091631.GA22933@hysteria.proulx.com> References: <20130115082312.GA7218@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130115082312.GA7218@localhost> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 0.8 (/) tag 13447 + notabug close 13447 thanks Ken Irving wrote: > (Previously sent in error to the bug-gnu-utils list.) Sending it to bug-gnu-utils was of course perfectly fine since "ln" is one of the GNU utils and that is a good mailing list for all of the utils as a general catchall. I even answered your question there. That was all perfectly fine. However after having had an answer there and having read it sending it here to bug-coreutils (every email here opens a bug ticket) was not good since it isn't the coreutils@gnu.org list you were directed to for discussion. And of course you already had an answer that it was in the kernel domain not the "ln" domain. So I am not sure what answer you are expecting to be different asking the same question again. Apparently you didn't like my answer. (shrug) > I've been using symbolic links in a non-file-related way, e.g., to store > arbitrary string values, Sure. This is done by many programs. Such as Emacs and Firefox for example which both store lock information. And others too. It is quite a commonly done technique. > but find that if I try to create a symlink with an empty 'target' > name, e.g., as 'ln -s "" foo', the error message emitted is not > really correct. > > $ ln -s "" foo > ln: creating symbolic link `foo' -> `': No such file or directory > $ ln -sf "" foo > ln: creating symbolic link `foo' -> `': No such file or directory 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. I ran it with strace to report what the kernel returned. $ strace -v -e symlink ln -s "" foo symlink("", "foo") = -1 ENOENT (No such file or directory) ln: creating symbolic link `foo' -> `': No such file or directory It can be seen the "ln" program is simply reporting what the kernel returned to it as errno. The kernel returned -1 indicating failure and set errno to ENOENT as to why. > A link can be created when no file or directory exists, e.g., > > $ stat x || ln -s x foo && echo ok > stat: cannot stat `x': No such file or directory > ok That is just fine. The value of the symlink can be an arbitrary value. Although I admit I didn't know it couldn't be a zero length string until you mentioned it. I only tested the Linux kernel. I now want to test other kernels. In particular BSD would be the gold standard reference for symlinks since they were developed there. > so it seems that 'No such file or directory' must not be the actual > reason for the failure. Perhaps something like 'null target name' > would be more accurate? 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 "."? 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. > I only happened upon this in working on a test script, and have no > expectation for the operation to succeed. In the future if you are looking for general discussion please consider posting to the coreutils@gnu.org mailing list which exists for general discussion of the coreutils project. Messages there won't open a bug ticket and won't be tracked in the bug tracking system. Note that just because I closed the bug ticket doesn't mean that discussion can't continue here. It just means that this bug ticket won't show up in the list of open bugs. Now that the ticket has been created feel free to continue discussion here with replies to the bug ticket. Bob From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Bernhard Voelker Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: Ken Irving Cc: 13447@debbugs.gnu.org Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824147621470 (code B ref 13447); Tue, 15 Jan 2013 09:18:02 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:17:56 +0000 Received: from localhost ([127.0.0.1]:60892 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2eZ-0005aE-T4 for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:17:56 -0500 Received: from moutng.kundenserver.de ([212.227.17.8]:54212) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2eX-0005a7-Dr for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:17:54 -0500 Received: from [192.168.1.11] (p4FC3E6F0.dip.t-dialin.net [79.195.230.240]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LhkoL-1T8Wbi23FJ-00mj8Y; Tue, 15 Jan 2013 10:17:23 +0100 Message-ID: <50F51EA2.5060308@bernhard-voelker.de> Date: Tue, 15 Jan 2013 10:17:22 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> In-Reply-To: <20130115082312.GA7218@localhost> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:ShhtZUAodrt4uHMlGJaVPCiCtWzYUUXbm17NNgEwdaC GpL5/b2PGMiRbVS3fv41AlEJmt2XV4exXfK3L8uUhjv1k+h9Dt /QfFgORiepYkEOpqAzzx17nxLBEViCmekDwmkfNCGQo2gRBcyt IKh4hOGnVCJXRzs2OYpQUhrkzkPU8vGTzV9JriPcFBdwIA6pyk PvjJRJ90hhZZ4s0/OCVXTWzIAEQRS4SXihyBl+goffhTkon+fL vnWiim8a1DxZMkIUT2BBDYpYWJJ7a2e18TC2m13DAsSBCoZzpO VsmOKeorOS48rfmgiwLoXjA2xt0nXm1ieVHYv0Ifhnef3Cao6n erozH34eUExpHrRc+TpZPvb6siABx9fD0XcjDSMf5 X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) On 01/15/2013 09:23 AM, Ken Irving wrote: > (Previously sent in error to the bug-gnu-utils list.) > > I've been using symbolic links in a non-file-related way, e.g., to store > arbitrary string values, but find that if I try to create a symlink with > an empty 'target' name, e.g., as 'ln -s "" foo', the error message emitted > is not really correct. > > $ ln -s "" foo > ln: creating symbolic link `foo' -> `': No such file or directory > $ ln -sf "" foo > ln: creating symbolic link `foo' -> `': No such file or directory > > A link can be created when no file or directory exists, e.g., > > $ stat x || ln -s x foo && echo ok > stat: cannot stat `x': No such file or directory > ok > > so it seems that 'No such file or directory' must not be the actual > reason for the failure. Perhaps something like 'null target name' > would be more accurate? > > I only happened upon this in working on a test script, and have no > expectation for the operation to succeed. > > Thanks > > Ken Irving Thanks for the report, however this particular issue has previously dicussed: http://lists.gnu.org/archive/html/coreutils/2012-11/msg00008.html The problem is that some coreutils programs do handle this special case - i.e. "" as argument for file names - while others do not. But no-one came up with patches to fix it yet - including me ;-) Have a nice day, Berny From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Ken Irving Cc: 13447@debbugs.gnu.org Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824170321851 (code B ref 13447); Tue, 15 Jan 2013 09:22:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:21:43 +0000 Received: from localhost ([127.0.0.1]:60901 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2iE-0005gM-36 for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:21:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57536) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2iB-0005gE-8c for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:21:40 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0F9KoQx012783 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Jan 2013 04:21:08 -0500 Received: from [10.36.116.51] (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0F9KlJ7012943 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 15 Jan 2013 04:20:49 -0500 Message-ID: <50F51F6F.8080609@draigBrady.com> Date: Tue, 15 Jan 2013 09:20:47 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> In-Reply-To: <20130115082312.GA7218@localhost> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r0F9KoQx012783 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.0 (-----) On 01/15/2013 08:23 AM, Ken Irving wrote: > (Previously sent in error to the bug-gnu-utils list.) > > I've been using symbolic links in a non-file-related way, e.g., to stor= e > arbitrary string values, but find that if I try to create a symlink wit= h > an empty 'target' name, e.g., as 'ln -s "" foo', the error message emit= ted > is not really correct. > > $ ln -s "" foo > ln: creating symbolic link `foo' -> `': No such file or directory > $ ln -sf "" foo > ln: creating symbolic link `foo' -> `': No such file or directory > > A link can be created when no file or directory exists, e.g., > > $ stat x || ln -s x foo && echo ok > stat: cannot stat `x': No such file or directory > ok > > so it seems that 'No such file or directory' must not be the actual > reason for the failure. Perhaps something like 'null target name' > would be more accurate? > > I only happened upon this in working on a test script, and have no > expectation for the operation to succeed. We're just reporting what the operating system returns here: $ python -c 'import os; os.symlink("","tl")' Traceback (most recent call last): File "", line 1, in OSError: [Errno 2] No such file or directory Interestingly I notice that solaris for example allows a NULL old_path. I suppose we could handle this case specially like: if (errno =3D=3D ENOENT && !*old_path) error(...,"An empty target is not supported on this system"); Though I'm not sure there's much benefit in a specific error message in this case? thanks, P=E1draig. From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824232126288 (code B ref 13447); Tue, 15 Jan 2013 09:32:02 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:32:01 +0000 Received: from localhost ([127.0.0.1]:60907 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2sD-0006px-CJ for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:32:01 -0500 Received: from mx.meyering.net ([88.168.87.75]:48444) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv2sA-0006po-Ae for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:31:59 -0500 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 7F97B600DF; Tue, 15 Jan 2013 10:31:28 +0100 (CET) From: Jim Meyering In-Reply-To: <50F51F6F.8080609@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of "Tue, 15 Jan 2013 09:20:47 +0000") References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> Date: Tue, 15 Jan 2013 10:31:28 +0100 Message-ID: <87d2x6lrm7.fsf@rho.meyering.net> Lines: 57 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) P=E1draig Brady wrote: > On 01/15/2013 08:23 AM, Ken Irving wrote: >> (Previously sent in error to the bug-gnu-utils list.) >> >> I've been using symbolic links in a non-file-related way, e.g., to store >> arbitrary string values, but find that if I try to create a symlink with >> an empty 'target' name, e.g., as 'ln -s "" foo', the error message emitt= ed >> is not really correct. >> >> $ ln -s "" foo >> ln: creating symbolic link `foo' -> `': No such file or directory >> $ ln -sf "" foo >> ln: creating symbolic link `foo' -> `': No such file or directory >> >> A link can be created when no file or directory exists, e.g., >> >> $ stat x || ln -s x foo && echo ok >> stat: cannot stat `x': No such file or directory >> ok >> >> so it seems that 'No such file or directory' must not be the actual >> reason for the failure. Perhaps something like 'null target name' >> would be more accurate? >> >> I only happened upon this in working on a test script, and have no >> expectation for the operation to succeed. > > We're just reporting what the operating system returns here: > > $ python -c 'import os; os.symlink("","tl")' > Traceback (most recent call last): > File "", line 1, in > OSError: [Errno 2] No such file or directory > > Interestingly I notice that solaris for example allows a NULL old_path. That Solaris behavior is contrary to POSIX 2008 http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html If someone is motivated, this suggests a symlink wrapper in gnulib would be welcome: it would make it so even on Solaris, symlink(any, "") would fail with the required ENOENT. > I suppose we could handle this case specially like: > > if (errno =3D=3D ENOENT && !*old_path) > error(...,"An empty target is not supported on this system"); s/supported.*/portable|valid/? > Though I'm not sure there's much benefit in a specific > error message in this case? I could go either way. There is precedent, but it's such a corner case, it may not be worth the added code. From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: 13447@debbugs.gnu.org Cc: Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824311227563 (code B ref 13447); Tue, 15 Jan 2013 09:46:02 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:45:12 +0000 Received: from localhost ([127.0.0.1]:60913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv34x-0007AW-Mb for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:45:11 -0500 Received: from joseki.proulx.com ([216.17.153.58]:32858) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv34u-0007AN-1O for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:45:09 -0500 Received: from hysteria.proulx.com (hysteria.proulx.com [192.168.230.119]) by joseki.proulx.com (Postfix) with ESMTP id 3A93A211D5; Tue, 15 Jan 2013 02:44:38 -0700 (MST) Received: by hysteria.proulx.com (Postfix, from userid 1000) id E8DA82DCDC; Tue, 15 Jan 2013 02:44:37 -0700 (MST) Date: Tue, 15 Jan 2013 02:44:37 -0700 From: Bob Proulx Message-ID: <20130115094437.GA27481@hysteria.proulx.com> References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <87d2x6lrm7.fsf@rho.meyering.net> User-Agent: Mutt/1.5.21 (2010-09-15) Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) Jim Meyering wrote: > P=E1draig Brady wrote: > > Interestingly I notice that solaris for example allows a NULL old_pat= h. >=20 > That Solaris behavior is contrary to POSIX 2008 > http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html Where does it say this? I read it through in detail but I didn't see that it required a diagnostic to be emitted in the case that value is am empty string. What did I miss? Bob From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Jim Meyering Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824364028308 (code B ref 13447); Tue, 15 Jan 2013 09:54:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:54:00 +0000 Received: from localhost ([127.0.0.1]:60919 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3DT-0007MV-Ib for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:54:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:16962) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3DQ-0007MN-RK for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:53:58 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0F9rPaJ026582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Jan 2013 04:53:26 -0500 Received: from [10.36.116.51] (ovpn-116-51.ams2.redhat.com [10.36.116.51]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0F9rMhV013296 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 15 Jan 2013 04:53:24 -0500 Message-ID: <50F52712.7080604@draigBrady.com> Date: Tue, 15 Jan 2013 09:53:22 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> In-Reply-To: <87d2x6lrm7.fsf@rho.meyering.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id r0F9rPaJ026582 X-Spam-Score: -4.2 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) On 01/15/2013 09:31 AM, Jim Meyering wrote: > P=E1draig Brady wrote: > >> On 01/15/2013 08:23 AM, Ken Irving wrote: >>> (Previously sent in error to the bug-gnu-utils list.) >>> >>> I've been using symbolic links in a non-file-related way, e.g., to st= ore >>> arbitrary string values, but find that if I try to create a symlink w= ith >>> an empty 'target' name, e.g., as 'ln -s "" foo', the error message em= itted >>> is not really correct. >>> >>> $ ln -s "" foo >>> ln: creating symbolic link `foo' -> `': No such file or directo= ry >>> $ ln -sf "" foo >>> ln: creating symbolic link `foo' -> `': No such file or directo= ry >>> >>> A link can be created when no file or directory exists, e.g., >>> >>> $ stat x || ln -s x foo && echo ok >>> stat: cannot stat `x': No such file or directory >>> ok >>> >>> so it seems that 'No such file or directory' must not be the actual >>> reason for the failure. Perhaps something like 'null target name' >>> would be more accurate? >>> >>> I only happened upon this in working on a test script, and have no >>> expectation for the operation to succeed. >> >> We're just reporting what the operating system returns here: >> >> $ python -c 'import os; os.symlink("","tl")' >> Traceback (most recent call last): >> File "", line 1, in >> OSError: [Errno 2] No such file or directory >> >> Interestingly I notice that solaris for example allows a NULL old_path. > > That Solaris behavior is contrary to POSIX 2008 > http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html The POSIX ENOENT description only mentions the empty path2 case. I.E. the empty symlink name, which as expected would return ENOENT. > If someone is motivated, this suggests a symlink wrapper > in gnulib would be welcome: it would make it so even on > Solaris, symlink(any, "") would fail with the required ENOENT. > >> I suppose we could handle this case specially like: >> >> if (errno =3D=3D ENOENT && !*old_path) >> error(...,"An empty target is not supported on this system"); > > s/supported.*/portable|valid/? > >> Though I'm not sure there's much benefit in a specific >> error message in this case? > > I could go either way. > There is precedent, but it's such a corner case, > it may not be worth the added code. given the confusion above, it might be worth the clarification error message. thanks, P=E1draig. From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Bernhard Voelker Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 09:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Bob Proulx Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824374428478 (code B ref 13447); Tue, 15 Jan 2013 09:56:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:55:44 +0000 Received: from localhost ([127.0.0.1]:60924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3F7-0007PE-RK for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:55:43 -0500 Received: from moutng.kundenserver.de ([212.227.17.9]:60563) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3F2-0007P1-Kw for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:55:38 -0500 Received: from [192.168.1.11] (p4FC3E6F0.dip.t-dialin.net [79.195.230.240]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MJmWC-1Ttwlk3pcS-001FaO; Tue, 15 Jan 2013 10:55:01 +0100 Message-ID: <50F52774.4040406@bernhard-voelker.de> Date: Tue, 15 Jan 2013 10:55:00 +0100 From: Bernhard Voelker User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> In-Reply-To: <20130115094437.GA27481@hysteria.proulx.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:I8UIfz6okoPBCP6pnrvq1ga+wzE3+U4bakE+YNdEfiz w9L4nrK5qQ/oMuNhvuRJ5q+lcHSzL8o634kHRDjrOV0p/T4nSu rw31zp2y/cu9H2DtdsJxUTQisU8HUzeqlawFG/FTJT6ChGTWVx Pk/3vlL5Dvhn2QrCmf/8ykFQRLgrRINzAJmEPoH6rUzuN6o2uH nAUa9l5RkpkMuTQlCB91x0BFUEGjdH/WK2vRW1STtCn5eDZSnj Eddo/ZmVWooJaQyx8H3JUod3GU7NZGwvxyVciRv2JGFZauJnxv edoVJ1uqkvPLuFSaCZ/Rjd/qe2z6cu2Py9QVN5bJnOB4pUFAW0 4cNVIbyJ+C2BZd/4W4RhFdM3OjMzMrys82BHGhuX8 X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.0 (/) On 01/15/2013 10:44 AM, Bob Proulx wrote: > Jim Meyering wrote: >> Pádraig Brady wrote: >>> Interestingly I notice that solaris for example allows a NULL old_path. >> >> That Solaris behavior is contrary to POSIX 2008 >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html > > Where does it say this? I read it through in detail but I didn't see > that it required a diagnostic to be emitted in the case that value is > am empty string. What did I miss? Right, the only 3 statements about path1 are: * The string pointed to by path1 shall be treated only as a character string and shall not be validated as a pathname. * [ENAMETOOLONG] [...] or the length of the path1 argument is longer than {SYMLINK_MAX}. * [...] in fact, the file named by the path1 argument need not exist when the link is created. I'd read this as: a) there can be any character in the string but a NULL (obviously). b) the maximum length is limited to SYMLINK_MAX. Nothing more. BUT: Some CU tools already catch zero-length file names (du and wc), and a comment in the code states that FTS has problems with it [src/du.c:1043]: /* Report and skip any empty file names before invoking fts. This works around a glitch in fts, which fails immediately (without looking at the other file names) when given an empty file name. */ Have a nice day, Berny From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 10:00:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Bob Proulx Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135824394828795 (code B ref 13447); Tue, 15 Jan 2013 10:00:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 09:59:08 +0000 Received: from localhost ([127.0.0.1]:60929 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3IR-0007UM-Ok for submit@debbugs.gnu.org; Tue, 15 Jan 2013 04:59:08 -0500 Received: from mx.meyering.net ([88.168.87.75]:48475) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv3IP-0007UF-Vw for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 04:59:07 -0500 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 33D5B6025A; Tue, 15 Jan 2013 10:58:36 +0100 (CET) From: Jim Meyering In-Reply-To: <20130115094437.GA27481@hysteria.proulx.com> (Bob Proulx's message of "Tue, 15 Jan 2013 02:44:37 -0700") References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> Date: Tue, 15 Jan 2013 10:58:36 +0100 Message-ID: <877gnelqcz.fsf@rho.meyering.net> Lines: 27 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.5 (-) Bob Proulx wrote: > Jim Meyering wrote: >> P=E1draig Brady wrote: >> > Interestingly I notice that solaris for example allows a NULL old_path. >> >> That Solaris behavior is contrary to POSIX 2008 >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html > > Where does it say this? I read it through in detail but I didn't see > that it required a diagnostic to be emitted in the case that value is > am empty string. What did I miss? Oh! You're right. Thanks for pointing that out. It's only the source (2nd argument) to symlink that may not be the empty string. ERRORS These functions shall fail if: [EACCES] ... [ENOENT] A component of path2 does not name an existing file or path2 is an empty string. There is no restriction on "path1". From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 14:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Jim Meyering Cc: 13447@debbugs.gnu.org, Ken Irving , Austin Group , Bob Proulx Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135825936222855 (code B ref 13447); Tue, 15 Jan 2013 14:17:02 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 14:16:02 +0000 Received: from localhost ([127.0.0.1]:32874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv7J3-0005wM-Sy for submit@debbugs.gnu.org; Tue, 15 Jan 2013 09:16:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38792) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv7J0-0005w7-LF for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 09:16:00 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0FEFPrR002289 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Jan 2013 09:15:25 -0500 Received: from [10.3.113.115] (ovpn-113-115.phx2.redhat.com [10.3.113.115]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0FEFNSo013213; Tue, 15 Jan 2013 09:15:23 -0500 Message-ID: <50F5647B.9060203@redhat.com> Date: Tue, 15 Jan 2013 07:15:23 -0700 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> <877gnelqcz.fsf@rho.meyering.net> In-Reply-To: <877gnelqcz.fsf@rho.meyering.net> X-Enigmail-Version: 1.5.0 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2QOODJPLOGQNKSUWONOOR" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2QOODJPLOGQNKSUWONOOR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable [adding the Austin Group] On 01/15/2013 02:58 AM, Jim Meyering wrote: >>> That Solaris behavior is contrary to POSIX 2008 >>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.htm= l >> >> Where does it say this? I read it through in detail but I didn't see >> that it required a diagnostic to be emitted in the case that value is >> am empty string. What did I miss? >=20 > Oh! You're right. Thanks for pointing that out. > It's only the source (2nd argument) to symlink that may not > be the empty string. I also checked POSIX 2008 TC1 (in the middle of ratification process), and while it altered the wording, it still mentions only path2: On Page: 2058 Line: 65095 Section: symlink() In the ERRORS section, change the [ENOENT] error from: [ENOENT] A component of path2 does not name an existing file or path2 is an empty string. to: [ENOENT] A component of the path prefix of path2 does not name an existing file or path2 is an empty string. [ENOENT] or [ENOTDIR] The path2 argument contains at least one non- character and ends with one or more trailing characters. If path2 names an existing file, an [ENOENT] error shall not occur. Rationale: Austin Group Defect Report(s) applied: 146,428,436. See http://austingroupbugs.net/view.php?id=3D146 See http://austingroupbugs.net/view.php?id=3D428 See http://austingroupbugs.net/view.php?id=3D436 What do others on the Austin Group think about an empty string for path1 in symlink()? Current Linux rejects the symlink() call with ENOENT; FreeBSD 8.2 allows it but refuses to resolve the symlink ("ln -s '' a && ls a/" reports ENOENT); Solaris 10 allows it and resolves the symlink as though it were '.' ("ln -s '' a && ls a/" reports the current directory contents). --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2QOODJPLOGQNKSUWONOOR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ9WR7AAoJEKeha0olJ0Nqu4gIAJKGl4CrR4SNIGwvXPCsDq2Y k56h3J4qDLBrqxR8HOgQurhyBeL1BWFEHOm4ggl+0yan5RCauMQczUlDQar71VJE 8XmZnJPo6WBKt8cSydYOi1FgdLDmqlPVBLgqZGUKeMID499XNzFMAF2KWTk177fs PrwvnDfBDYJQlD1plvLA4L8Ql4j7/Qvqm7jaWNaor2tSoYl1m79CyiJ0CGTOfp4D qwDkV3umzBnWDs+07dxCbzH9anmA1IvqA6T5EM8DIvGqiYCfjLit8fG22809RZDa om46mjMmkWAj7heO/gtLvxKYmM5x88+kW/YwuYtwNMXKmZcq+P3HpIsemf+56S0= =+LTT -----END PGP SIGNATURE----- ------enig2QOODJPLOGQNKSUWONOOR-- From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 14:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135826010823897 (code B ref 13447); Tue, 15 Jan 2013 14:29:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 14:28:28 +0000 Received: from localhost ([127.0.0.1]:32879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv7V1-0006DG-FE for submit@debbugs.gnu.org; Tue, 15 Jan 2013 09:28:26 -0500 Received: from mx.meyering.net ([88.168.87.75]:48786) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv7Ux-0006D6-CJ for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 09:28:21 -0500 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 16C53601B2; Tue, 15 Jan 2013 15:27:48 +0100 (CET) From: Jim Meyering In-Reply-To: <50F52712.7080604@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of "Tue, 15 Jan 2013 09:53:22 +0000") References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <50F52712.7080604@draigBrady.com> Date: Tue, 15 Jan 2013 15:27:48 +0100 Message-ID: <87libujzbv.fsf@rho.meyering.net> Lines: 10 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.5 (-) P=E1draig Brady wrote: ... >> I could go either way. >> There is precedent, but it's such a corner case, >> it may not be worth the added code. > > given the confusion above, it might be worth the > clarification error message. Yes, I've demonstrated that rather well ;-) From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Geoff Clare Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Tue, 15 Jan 2013 16:30:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Austin Group Cc: 13447@debbugs.gnu.org, Ken Irving , Jim Meyering , Bob Proulx Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.13582673425919 (code B ref 13447); Tue, 15 Jan 2013 16:30:01 +0000 Received: (at 13447) by debbugs.gnu.org; 15 Jan 2013 16:29:02 +0000 Received: from localhost ([127.0.0.1]:33625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv9Ni-0001X6-VD for submit@debbugs.gnu.org; Tue, 15 Jan 2013 11:29:01 -0500 Received: from smtp159.iad.emailsrvr.com ([207.97.245.159]:34370) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tv8lv-0000e4-Kj for 13447@debbugs.gnu.org; Tue, 15 Jan 2013 10:49:57 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp35.relay.iad1a.emailsrvr.com (SMTP Server) with ESMTP id F05EF2C8463; Tue, 15 Jan 2013 10:49:24 -0500 (EST) X-Virus-Scanned: OK Received: by smtp35.relay.iad1a.emailsrvr.com (Authenticated sender: gwc-AT-mail.opengroup.org) with ESMTPSA id EE77F2C845F; Tue, 15 Jan 2013 10:49:23 -0500 (EST) Date: Tue, 15 Jan 2013 15:49:21 +0000 From: Geoff Clare Message-ID: <20130115154920.GA19071@lt.loopback> References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> <877gnelqcz.fsf@rho.meyering.net> <50F5647B.9060203@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <50F5647B.9060203@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: 0.1 (/) X-Mailman-Approved-At: Tue, 15 Jan 2013 11:28:56 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Eric Blake wrote, on 15 Jan 2013: > > [adding the Austin Group] > > On 01/15/2013 02:58 AM, Jim Meyering wrote: > > >>> That Solaris behavior is contrary to POSIX 2008 > >>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html > >> > >> Where does it say this? I read it through in detail but I didn't see > >> that it required a diagnostic to be emitted in the case that value is > >> am empty string. What did I miss? > > > > Oh! You're right. Thanks for pointing that out. > > It's only the source (2nd argument) to symlink that may not > > be the empty string. > > I also checked POSIX 2008 TC1 (in the middle of ratification process), > and while it altered the wording, it still mentions only path2: > > On Page: 2058 Line: 65095 Section: symlink() > In the ERRORS section, change the [ENOENT] error from: > [ENOENT] A component of path2 does not name an existing file or > path2 is an empty string. > to: > [ENOENT] A component of the path prefix of path2 does not name an > existing file or path2 is an empty string. > [ENOENT] or [ENOTDIR] > The path2 argument contains at least one non- character and ends > with one or more trailing characters. If path2 names an existing > file, an [ENOENT] error shall not occur. > Rationale: Austin Group Defect Report(s) applied: 146,428,436. > See http://austingroupbugs.net/view.php?id=146 > See http://austingroupbugs.net/view.php?id=428 > See http://austingroupbugs.net/view.php?id=436 > > What do others on the Austin Group think about an empty string for path1 > in symlink()? The 2nd paragraph of the description clearly states: The string pointed to by path1 shall be treated only as a character string and shall not be validated as a pathname. An implementation which gives an ENOENT error for an empty path1 string is treating the string as a pathname and therefore does not conform. > Current Linux rejects the symlink() call with ENOENT; > FreeBSD 8.2 allows it but refuses to resolve the symlink ("ln -s '' a && > ls a/" reports ENOENT); Solaris 10 allows it and resolves the symlink as > though it were '.' ("ln -s '' a && ls a/" reports the current directory > contents). Presumably if you follow the pathname resolution rules to the letter you will end up with either the FreeBSD or the Solaris behaviour being the required one. Of course, whichever one it is, that may be an accidental outcome of the way the pathname resolution section is written rather than an intention to disallow the other behaviour. -- Geoff Clare The Open Group, Apex Plaza, Forbury Road, Reading, RG1 1AX, England From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Joerg Schilling Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 16 Jan 2013 16:37:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: , Cc: 13447@debbugs.gnu.org, ken.irving@alaska.edu, austin-group-l@opengroup.org, bob@proulx.com Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135835418924038 (code B ref 13447); Wed, 16 Jan 2013 16:37:04 +0000 Received: (at 13447) by debbugs.gnu.org; 16 Jan 2013 16:36:29 +0000 Received: from localhost ([127.0.0.1]:35478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvVyV-0006FZ-Rx for submit@debbugs.gnu.org; Wed, 16 Jan 2013 11:36:29 -0500 Received: from mx-relay04-haj2.antispameurope.com ([83.246.65.204]:59038) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvQqm-0006DT-SF for 13447@debbugs.gnu.org; Wed, 16 Jan 2013 06:08:11 -0500 Received: from FEYNMAN.fokus.fraunhofer.de (feynman.fokus.fraunhofer.de [10.147.9.202]) by pluto.fokus.fraunhofer.de (8.14.4/8.14.2) with ESMTP id r0GB7S5j023083 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=OK); Wed, 16 Jan 2013 12:07:28 +0100 (CET) Received: from rigel (10.147.13.100) by FEYNMAN.fokus.fraunhofer.de (10.147.9.202) with Microsoft SMTP Server id 14.2.318.4; Wed, 16 Jan 2013 12:07:26 +0100 Date: Wed, 16 Jan 2013 12:07:27 +0100 From: Joerg Schilling Message-ID: <50f689ef.g6ZJy6vWwXJqmoZH%Joerg.Schilling@fokus.fraunhofer.de> References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> <877gnelqcz.fsf@rho.meyering.net> <50F5647B.9060203@redhat.com> In-Reply-To: <50F5647B.9060203@redhat.com> User-Agent: nail 11.22 3/20/05 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean X-cloud-security-sender: joerg.schilling@fokus.fraunhofer.de X-cloud-security-recipient: 13447@debbugs.gnu.org X-cloud-security-Virusscan: CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-gate04-haj2 with 9C097794002 X-cloud-security: scantime:.2359 X-Spam-Score: -2.3 (--) X-Mailman-Approved-At: Wed, 16 Jan 2013 11:36:26 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Eric Blake wrote: > [adding the Austin Group] > > On 01/15/2013 02:58 AM, Jim Meyering wrote: > > >>> That Solaris behavior is contrary to POSIX 2008 > >>> http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html > >> > >> Where does it say this? I read it through in detail but I didn't see > >> that it required a diagnostic to be emitted in the case that value is > >> am empty string. What did I miss? > > > > Oh! You're right. Thanks for pointing that out. > > It's only the source (2nd argument) to symlink that may not > > be the empty string. > > I also checked POSIX 2008 TC1 (in the middle of ratification process), > and while it altered the wording, it still mentions only path2: > > On Page: 2058 Line: 65095 Section: symlink() > In the ERRORS section, change the [ENOENT] error from: > [ENOENT] A component of path2 does not name an existing file or > path2 is an empty string. > to: > [ENOENT] A component of the path prefix of path2 does not name an > existing file or path2 is an empty string. > [ENOENT] or [ENOTDIR] > The path2 argument contains at least one non- character and ends > with one or more trailing characters. If path2 names an existing > file, an [ENOENT] error shall not occur. > Rationale: Austin Group Defect Report(s) applied: 146,428,436. > See http://austingroupbugs.net/view.php?id=146 > See http://austingroupbugs.net/view.php?id=428 > See http://austingroupbugs.net/view.php?id=436 > > What do others on the Austin Group think about an empty string for path1 > in symlink()? Current Linux rejects the symlink() call with ENOENT; > FreeBSD 8.2 allows it but refuses to resolve the symlink ("ln -s '' a && > ls a/" reports ENOENT); Solaris 10 allows it and resolves the symlink as > though it were '.' ("ln -s '' a && ls a/" reports the current directory > contents). I believe that symlink("", "foo") should be valid according to http://pubs.opengroup.org/onlinepubs/9699919799/functions/symlink.html On the other side, Solaris (correctly) returns ENOENT for open("", O_RDONLY); so the question is how symlink processing should be done in the kernel. If the symlink target is to be treated as a list of path name components, I would expect ENOENT with an attempt to open() or stat() "a/". If the symlink target is treated as a string that is concatenated to the previous path, Solaris could be seen as correct. Solaris replaces an empty symlink target ("") by "." before replacing the current path name component in the path currently being processed by the symlink target string before continuing with the path processing on the resulting path. Jörg -- EMail:joerg@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin js@cs.tu-berlin.de (uni) joerg.schilling@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Wed, 16 Jan 2013 17:59:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Joerg Schilling Cc: jim@meyering.net, austin-group-l@opengroup.org, 13447@debbugs.gnu.org, ken.irving@alaska.edu, bob@proulx.com, eblake@redhat.com Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.13583591402609 (code B ref 13447); Wed, 16 Jan 2013 17:59:01 +0000 Received: (at 13447) by debbugs.gnu.org; 16 Jan 2013 17:59:00 +0000 Received: from localhost ([127.0.0.1]:35553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvXGN-0000g2-S4 for submit@debbugs.gnu.org; Wed, 16 Jan 2013 12:59:00 -0500 Received: from smtp.cs.ucla.edu ([131.179.128.62]:46224) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvXGM-0000fv-8C for 13447@debbugs.gnu.org; Wed, 16 Jan 2013 12:58:58 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id 93DA739E8105; Wed, 16 Jan 2013 09:58:21 -0800 (PST) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rY4z1+Jg28na; Wed, 16 Jan 2013 09:58:21 -0800 (PST) Received: from penguin.cs.ucla.edu (Penguin.CS.UCLA.EDU [131.179.64.200]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 27D1939E8100; Wed, 16 Jan 2013 09:58:21 -0800 (PST) Message-ID: <50F6EA3C.4090203@cs.ucla.edu> Date: Wed, 16 Jan 2013 09:58:20 -0800 From: Paul Eggert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> <877gnelqcz.fsf@rho.meyering.net> <50F5647B.9060203@redhat.com> <50f689ef.g6ZJy6vWwXJqmoZH%Joerg.Schilling@fokus.fraunhofer.de> In-Reply-To: <50f689ef.g6ZJy6vWwXJqmoZH%Joerg.Schilling@fokus.fraunhofer.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) On 01/16/13 03:07, Joerg Schilling wrote: > If the symlink target is to be treated as a list of path name components, > I would expect ENOENT with an attempt to open() or stat() "a/". > > If the symlink target is treated as a string that is concatenated to the > previous path, Solaris could be seen as correct. Except that Solaris also treats the symlink as "." even if there is no previous path. For example, on Solaris 11: $ ln -s '' empty $ ls -l empty lrwxrwxrwx 1 eggert faculty 0 Jan 16 09:56 empty -> $ cat empty cat: input error on empty: Is a directory $ cat '' cat: cannot open : No such file or directory This is an undesirable inconsistency, and it's hard to see how any user would want this behavior. From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: =?UTF-8?Q?P=C3=A1draig?= Brady Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 17 Jan 2013 13:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: Jim Meyering Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.13584282072417 (code B ref 13447); Thu, 17 Jan 2013 13:11:02 +0000 Received: (at 13447) by debbugs.gnu.org; 17 Jan 2013 13:10:07 +0000 Received: from localhost ([127.0.0.1]:36363 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvpEM-0000ct-Ol for submit@debbugs.gnu.org; Thu, 17 Jan 2013 08:10:07 -0500 Received: from mail3.vodafone.ie ([213.233.128.45]:60112) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvpEJ-0000cj-7k for 13447@debbugs.gnu.org; Thu, 17 Jan 2013 08:10:04 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApwBAJn391BtTSm9/2dsb2JhbAANN4whshiDEQEBAQR5EAsNBAMBAgEJFg8JAwIBAgE9CAYKAwEFAgEBiCGnWJIckTgDjwiIIIRxjTGBaCQ Received: from unknown (HELO [192.168.1.79]) ([109.77.41.189]) by mail3.vodafone.ie with ESMTP; 17 Jan 2013 13:09:20 +0000 Message-ID: <50F7F800.3070408@draigBrady.com> Date: Thu, 17 Jan 2013 13:09:20 +0000 From: =?UTF-8?Q?P=C3=A1draig?= Brady User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <50F52712.7080604@draigBrady.com> <87libujzbv.fsf@rho.meyering.net> In-Reply-To: <87libujzbv.fsf@rho.meyering.net> Content-Type: multipart/mixed; boundary="------------090404090509040907040406" X-Spam-Score: 0.8 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) This is a multi-part message in MIME format. --------------090404090509040907040406 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit On 01/15/2013 02:27 PM, Jim Meyering wrote: > Pádraig Brady wrote: > ... >>> I could go either way. >>> There is precedent, but it's such a corner case, >>> it may not be worth the added code. >> >> given the confusion above, it might be worth the >> clarification error message. > > Yes, I've demonstrated that rather well ;-) Note to add the error robustly, we'd have to check that ENOENT wasn't in fact being generated for the link name. That would involve stat()s and TOCTOU issues. This Linux misinterpretation of POSIX has been present for a long time as can be seen by searching for sys_symlink in: http://repo.or.cz/w/davej-history.git/blame/HEAD:/fs/namei.c I sent the attached path to the kernel list, to see can we address it directly there. thanks, Pádraig. --------------090404090509040907040406 Content-Type: text/x-patch; name="symlink-empty.diff" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="symlink-empty.diff" >From a0d9810c5f4cf526430726f4e6aed88e8f9de1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 17 Jan 2013 12:53:16 +0000 Subject: [PATCH] symlink: allow an empty target string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit POSIX only states that ENOENT should be returned if an empty string is specified for the link name. In fact it states the link target... "shall be treated only as a character string and shall not be validated as a pathname". Signed-off-by: Pádraig Brady --- fs/namei.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/namei.c b/fs/namei.c index 43a97ee..26dd264 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -3533,12 +3533,13 @@ SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, int, newdfd, const char __user *, newname) { int error; + int empty; struct filename *from; struct dentry *dentry; struct path path; unsigned int lookup_flags = 0; - from = getname(oldname); + from = getname_flags(oldname, LOOKUP_EMPTY, &empty); if (IS_ERR(from)) return PTR_ERR(from); retry: -- 1.7.6.4 --------------090404090509040907040406-- From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Eric Blake Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 17 Jan 2013 16:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug Cc: 13447@debbugs.gnu.org, Ken Irving , Austin Group , Jim Meyering , Bob Proulx Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135843898118591 (code B ref 13447); Thu, 17 Jan 2013 16:10:01 +0000 Received: (at 13447) by debbugs.gnu.org; 17 Jan 2013 16:09:41 +0000 Received: from localhost ([127.0.0.1]:37146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tvs28-0004po-Kn for submit@debbugs.gnu.org; Thu, 17 Jan 2013 11:09:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27710) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tvs25-0004pd-T8 for 13447@debbugs.gnu.org; Thu, 17 Jan 2013 11:09:39 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0HG8sgS015202 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 17 Jan 2013 11:08:54 -0500 Received: from [10.3.113.104] (ovpn-113-104.phx2.redhat.com [10.3.113.104]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0HG8qJx031439; Thu, 17 Jan 2013 11:08:52 -0500 Message-ID: <50F82213.306@redhat.com> Date: Thu, 17 Jan 2013 09:08:51 -0700 From: Eric Blake Organization: Red Hat, Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <20130115094437.GA27481@hysteria.proulx.com> <877gnelqcz.fsf@rho.meyering.net> <50F5647B.9060203@redhat.com> In-Reply-To: <50F5647B.9060203@redhat.com> X-Enigmail-Version: 1.5.0 OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2RGAPSXKDPTVSUDOACDOB" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -5.9 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2RGAPSXKDPTVSUDOACDOB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/15/2013 07:15 AM, Eric Blake wrote: > [adding the Austin Group] >=20 >=20 > What do others on the Austin Group think about an empty string for path= 1 > in symlink()? Current Linux rejects the symlink() call with ENOENT; > FreeBSD 8.2 allows it but refuses to resolve the symlink ("ln -s '' a &= & > ls a/" reports ENOENT); Solaris 10 allows it and resolves the symlink a= s > though it were '.' ("ln -s '' a && ls a/" reports the current directory= > contents). In today's Austin Group meeting, I was tasked to open a new bug that would state specifically how the empty symlink is resolved; the intent is to allow both Solaris behavior (current directory) and BSD behavior (ENOENT). Meanwhile, everyone was in agreement that the Linux kernel has a bug for rejecting the creation of an empty symlink, but once that bug is fixed, then Linux can choose either Solaris or BSD behavior for how to resolve such a symlink. It will probably be a bug report similar to this one, which regarded how to handle a symlink containing just slashes: http://austingroupbugs.net/view.php?id=3D541 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org ------enig2RGAPSXKDPTVSUDOACDOB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJQ+CITAAoJEKeha0olJ0NqcRAIAJADJrJIKaOGob+3Bh4fiAHb GpALOS9XpAqPB2OAclYGTo3crGol+Yu5+deGLJrbD1IA/bAYZY38hc+qGC8hc2bE liO1KZWR+zDZrOcHC2hIkAX37OfTOQAu+N6txaPZb0hGI5YUmyBZwVde2khFlWYs MM2cuyQItFOZwqVcG4P2R4xrOFEioKf97QnQ/vhxm8Fxqas8mBNOg5scb4EoxwmY lmPt+fbq8I3zzvxAbwVnpPK4SXKZcsYKUd91oxJ0ys3xWcHoJfsAfdK8GKCrHmVV JLCdu+grOcmeouCV8L7nRUKMjiIwFQjEKKUlk9rumVU8/X8tubgJap5x1IDfDgI= =Y/bx -----END PGP SIGNATURE----- ------enig2RGAPSXKDPTVSUDOACDOB-- From unknown Wed Aug 20 04:11:21 2025 X-Loop: help-debbugs@gnu.org Subject: bug#13447: ln "" foo gives misleading error message Resent-From: Jim Meyering Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Thu, 17 Jan 2013 16:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13447 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: notabug To: =?UTF-8?Q?P=C3=A1draig?= Brady Cc: 13447@debbugs.gnu.org, Ken Irving Received: via spool by 13447-submit@debbugs.gnu.org id=B13447.135844109221782 (code B ref 13447); Thu, 17 Jan 2013 16:45:02 +0000 Received: (at 13447) by debbugs.gnu.org; 17 Jan 2013 16:44:52 +0000 Received: from localhost ([127.0.0.1]:37204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TvsaC-0005fH-9A for submit@debbugs.gnu.org; Thu, 17 Jan 2013 11:44:52 -0500 Received: from mx.meyering.net ([88.168.87.75]:52471) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tvsa9-0005f8-AH for 13447@debbugs.gnu.org; Thu, 17 Jan 2013 11:44:50 -0500 Received: from rho.meyering.net (rho.meyering.net [127.0.0.1]) by rho.meyering.net (Acme Bit-Twister) with ESMTP id 7037360204; Thu, 17 Jan 2013 17:44:06 +0100 (CET) From: Jim Meyering In-Reply-To: <50F7F800.3070408@draigBrady.com> ("=?UTF-8?Q?P=C3=A1draig?= Brady"'s message of "Thu, 17 Jan 2013 13:09:20 +0000") References: <20130115082312.GA7218@localhost> <50F51F6F.8080609@draigBrady.com> <87d2x6lrm7.fsf@rho.meyering.net> <50F52712.7080604@draigBrady.com> <87libujzbv.fsf@rho.meyering.net> <50F7F800.3070408@draigBrady.com> Date: Thu, 17 Jan 2013 17:44:06 +0100 Message-ID: <878v7rhi95.fsf@rho.meyering.net> Lines: 28 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.5 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.3 (--) P=E1draig Brady wrote: > On 01/15/2013 02:27 PM, Jim Meyering wrote: >> P=E1draig Brady wrote: >> ... >>>> I could go either way. >>>> There is precedent, but it's such a corner case, >>>> it may not be worth the added code. >>> >>> given the confusion above, it might be worth the >>> clarification error message. >> >> Yes, I've demonstrated that rather well ;-) > > Note to add the error robustly, > we'd have to check that ENOENT wasn't > in fact being generated for the link name. > That would involve stat()s and TOCTOU issues. > > This Linux misinterpretation of POSIX has > been present for a long time as can be seen by > searching for sys_symlink in: > > http://repo.or.cz/w/davej-history.git/blame/HEAD:/fs/namei.c > > I sent the attached path to the kernel list, > to see can we address it directly there. Nice follow-up. Thanks!