From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#27871: [PATCH] Treat unreachable current directory as error Date: Sat, 30 Sep 2017 17:00:06 -0700 Organization: UCLA Computer Science Department Message-ID: References: <20170930185006.54096-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E19CBFB4322C21B426F09748" X-Trace: blaine.gmane.org 1506816089 12407 195.159.176.226 (1 Oct 2017 00:01:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 1 Oct 2017 00:01:29 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 Cc: Philipp Stephani To: Philipp Stephani , 27871@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Oct 01 02:01:25 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyRhF-0002nI-0f for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Oct 2017 02:01:25 +0200 Original-Received: from localhost ([::1]:40702 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyRhM-0001gx-GZ for geb-bug-gnu-emacs@m.gmane.org; Sat, 30 Sep 2017 20:01:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35642) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dyRgw-0001Vb-NK for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 20:01:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dyRgs-0004bx-JO for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 20:01:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:32930) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dyRgs-0004bi-GN for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 20:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dyRgs-000704-2J for bug-gnu-emacs@gnu.org; Sat, 30 Sep 2017 20:01:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Paul Eggert Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Oct 2017 00:01:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27871 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 27871-submit@debbugs.gnu.org id=B27871.150681601726837 (code B ref 27871); Sun, 01 Oct 2017 00:01:02 +0000 Original-Received: (at 27871) by debbugs.gnu.org; 1 Oct 2017 00:00:17 +0000 Original-Received: from localhost ([127.0.0.1]:41611 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyRg9-0006yn-7m for submit@debbugs.gnu.org; Sat, 30 Sep 2017 20:00:17 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:46178) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dyRg7-0006yY-4p for 27871@debbugs.gnu.org; Sat, 30 Sep 2017 20:00:15 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 0B29D16008A; Sat, 30 Sep 2017 17:00:08 -0700 (PDT) Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id jdQJmXcClT0K; Sat, 30 Sep 2017 17:00:07 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3F65B160AEB; Sat, 30 Sep 2017 17:00:07 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Original-Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id WbhBtsAUhPc8; Sat, 30 Sep 2017 17:00:07 -0700 (PDT) Original-Received: from [192.168.1.9] (unknown [47.154.18.85]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 1C2CB16008A; Sat, 30 Sep 2017 17:00:07 -0700 (PDT) In-Reply-To: <20170930185006.54096-1-phst@google.com> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:137725 Archived-At: This is a multi-part message in MIME format. --------------E19CBFB4322C21B426F09748 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Philipp Stephani wrote: > + if (!file_name_absolute_p (dir)) That doesn't look right here, since leading '~' counts as absolute to=20 file_name_absolute_p, which is not what is wanted here. > + errno =3D ENOTCONN; Why ENOTCONN? Shouldn't it be ENOENT? The failure has nothing to do with = socket=20 connections. Also, I'd feel a bit better if we apply the workaround only to the functi= on that=20 has the problem. How about the attached patch instead? --------------E19CBFB4322C21B426F09748 Content-Type: text/x-patch; name="0001-Fix-bug-with-unmounted-directory-on-GNU-Linux.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-Fix-bug-with-unmounted-directory-on-GNU-Linux.patch" =46rom a1f839b0c60fb345944ee39626e8645402c1f060 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 30 Sep 2017 16:53:54 -0700 Subject: [PATCH] Fix bug with unmounted directory on GNU/Linux * src/sysdep.c (emacs_get_current_dir_name): Do not use get_current_dir_name result unless it is absolute (Bug#27871). --- src/sysdep.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/sysdep.c b/src/sysdep.c index 1e6e0d011b..a3526c3740 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -232,7 +232,18 @@ emacs_get_current_dir_name (void) bool use_libc =3D true; # endif if (use_libc) - return get_current_dir_name (); + { + /* GNU/Linux get_current_dir_name can return a string starting + with "(unreachable)" (Bug#27871). */ + char *wd =3D get_current_dir_name (); + if (wd && ! (IS_DIRECTORY_SEP (*wd) || (*wd && IS_DEVICE_SEP (wd[1= ])))) + { + free (wd); + errno =3D ENOENT; + return NULL; + } + return wd; + } # endif =20 char *buf; --=20 2.13.5 --------------E19CBFB4322C21B426F09748--