From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#27871: [PATCH] Treat unreachable current directory as error Date: Sat, 07 Oct 2017 08:49:01 +0000 Message-ID: References: <20170930185006.54096-1-phst@google.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a113ade5e0698ee055af10844" X-Trace: blaine.gmane.org 1507366218 14001 195.159.176.226 (7 Oct 2017 08:50:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 7 Oct 2017 08:50:18 +0000 (UTC) Cc: Philipp Stephani To: Paul Eggert , 27871@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 07 10:50:13 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 1e0koG-0002H1-Hh for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Oct 2017 10:50:12 +0200 Original-Received: from localhost ([::1]:48918 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0koJ-00039H-Cr for geb-bug-gnu-emacs@m.gmane.org; Sat, 07 Oct 2017 04:50:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44081) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e0koC-00036h-JJ for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 04:50:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e0ko7-0004qz-2k for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 04:50:08 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e0ko6-0004qq-UO for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 04:50:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1e0ko6-000855-LE for bug-gnu-emacs@gnu.org; Sat, 07 Oct 2017 04:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 07 Oct 2017 08:50: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.150736615931003 (code B ref 27871); Sat, 07 Oct 2017 08:50:02 +0000 Original-Received: (at 27871) by debbugs.gnu.org; 7 Oct 2017 08:49:19 +0000 Original-Received: from localhost ([127.0.0.1]:53749 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0knO-00083z-U9 for submit@debbugs.gnu.org; Sat, 07 Oct 2017 04:49:19 -0400 Original-Received: from mail-oi0-f54.google.com ([209.85.218.54]:49782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e0knN-00083m-Ps for 27871@debbugs.gnu.org; Sat, 07 Oct 2017 04:49:18 -0400 Original-Received: by mail-oi0-f54.google.com with SMTP id w197so28349288oif.6 for <27871@debbugs.gnu.org>; Sat, 07 Oct 2017 01:49:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NUJBUJME7KsaQI/72Fcow7CwuufXZQ+6URd8bcR4L0I=; b=L5KJhatRQwr8cqKae8uKA9vnY5WWLKRcm26m4jvta8ztiolmB09aNwIkJudVxbRJ35 ctLeJT9yN0W9XqQQw7wouiA738/x0dM+iyvUhxY9pwIvq/hG0s9Qd4FUZzj4SpqBZzuD lGBmMEqV3+jZUXuT54l/8aHaJgnCMpuFFGZ8BjkAR6EQhG6wx7YH2sv85bYRI/fVaxMX Ktt/A6YsiN9MqvvTa+RQvvWaVxvhQi04J9us8jRaz8z4L/UDmeRUVrJ8OU0F8O26sPtO RtPolEYe1Sr8LNNy8+pQ7NTNzfSPN0dwt+sg2NJjq64bEy3PWTLXpapO29Hzwunrwugl L5jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NUJBUJME7KsaQI/72Fcow7CwuufXZQ+6URd8bcR4L0I=; b=dTcER9+s1lApbJKTX9bfZ169OO5VCRlWz+UoMp8wkTDvfsan7BGQZX+SLCjzvRthBo g4iqzKoODaNNrtFUdiyRLgSlQHJAXFo8DvK3rwXZD6MpyCCXZzO0/UoLKjvdrOA3sPkr g1noOo5gcphqsqIjiCBCnSh05AlL/ZG9nSk9qdIgJmZo47zhyz3P90l9gENlzNKK81Y8 6YCKwyOCjj6CR2MrSPH8Ke56ji0OiaFfrxZH7JDs1h6SmZ+grbJoLH1748jLs+ImH8CM hPrRqVjW1m0RLYu9lYPrt4RA9ZIo7pjsNpJBvx/hvTK5iKQA06+WDemdtLCvEHhxGBhP sUzw== X-Gm-Message-State: AMCzsaVZHucY4gYx6nCCuaQYk+T9LXRv6SPhepMQEnYOlyvYdZJwE1AS uIy38HZKKvoowFdIGt5V7p3xtFWd/Lm8zmKV6Yc= X-Google-Smtp-Source: AOwi7QBBm9UC/LFXntqLRO7TrR60OhBEj9ReJR+2bAdqQyopX+Za8P+renL3hvKEeyMWrnOJteNgWfTiz6s5yuQUnwg= X-Received: by 10.202.206.207 with SMTP id e198mr385378oig.150.1507366151814; Sat, 07 Oct 2017 01:49:11 -0700 (PDT) In-Reply-To: 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:138034 Archived-At: --001a113ade5e0698ee055af10844 Content-Type: text/plain; charset="UTF-8" Paul Eggert schrieb am So., 1. Okt. 2017 um 02:00 Uhr: > Philipp Stephani wrote: > > > + if (!file_name_absolute_p (dir)) > > That doesn't look right here, since leading '~' counts as absolute to > file_name_absolute_p, which is not what is wanted here. > That shouldn't matter because getcwd never returns a string starting with ~. > > > + errno = ENOTCONN; > > Why ENOTCONN? Shouldn't it be ENOENT? The failure has nothing to do with > socket > connections. > I think ENOTCONN is the error returned by stat(".") if the current directory doesn't exist. But I don't care much about the exact error number, any nonzero value should do the job. > > Also, I'd feel a bit better if we apply the workaround only to the > function that > has the problem. > > All of the current directory functions exhibit this behavior, including getwd and getcwd, so you need to make sure they are also covered. --001a113ade5e0698ee055af10844 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


Paul E= ggert <eggert@cs.ucla.edu> = schrieb am So., 1. Okt. 2017 um 02:00=C2=A0Uhr:
Philipp Stephani wrote:

> +=C2=A0 if (!file_name_absolute_p (dir))

That doesn't look right here, since leading '~' counts as absol= ute to
file_name_absolute_p, which is not what is wanted here.

That shouldn't matter because getcwd never returns a s= tring starting with ~.
=C2=A0

> +=C2=A0 =C2=A0 =C2=A0 errno =3D ENOTCONN;

Why ENOTCONN? Shouldn't it be ENOENT? The failure has nothing to do wit= h socket
connections.

I think ENOTCONN is the er= ror returned by stat(".") if the current directory doesn't ex= ist. But I don't care much about the exact error number, any nonzero va= lue should do the job.
=C2=A0

Also, I'd feel a bit better if we apply the workaround only to the func= tion that
has the problem.


All of the current directory functions= exhibit this behavior, including getwd and getcwd, so you need to make sur= e they are also covered.
--001a113ade5e0698ee055af10844--