From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#26911: 25.2; eshell "cd .." doesn't work correctly with TRAMP Date: Sun, 30 Aug 2020 14:39:28 -0700 Organization: UCLA Computer Science Department Message-ID: <6acf8cfa-6071-e7b1-3055-04292634bb39@cs.ucla.edu> References: <693aa189-03fa-b963-89eb-ce19c51ba325@cs.ucla.edu> <83wo1jz32t.fsf@gnu.org> <83sgc7z220.fsf@gnu.org> <83r1rryrk0.fsf@gnu.org> <47047d69-91aa-fd0d-1510-64ba7c246970@cs.ucla.edu> <83a6yeynd1.fsf@gnu.org> <03a31052-795a-c169-c199-2b0f3ba88ec2@cs.ucla.edu> <83sgc5xq8k.fsf@gnu.org> <164450fe-7f86-e336-87d4-13c52e52c61c@cs.ucla.edu> <83eenoxm18.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40769"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cc: 26911@debbugs.gnu.org, mattiase@acm.org, michael.albinus@gmx.de, yegortimoshenko@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 30 23:40:10 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kCV3Z-000ASe-V8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Aug 2020 23:40:10 +0200 Original-Received: from localhost ([::1]:43508 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCV3Y-0005Yt-UI for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Aug 2020 17:40:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCV3S-0005Ye-9E for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 17:40:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCV3R-0001kO-Uu for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 17:40:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kCV3R-0008Bb-R2 for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 17:40:01 -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, 30 Aug 2020 21:40:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26911 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 26911-submit@debbugs.gnu.org id=B26911.159882357631432 (code B ref 26911); Sun, 30 Aug 2020 21:40:01 +0000 Original-Received: (at 26911) by debbugs.gnu.org; 30 Aug 2020 21:39:36 +0000 Original-Received: from localhost ([127.0.0.1]:50902 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCV32-0008Au-5N for submit@debbugs.gnu.org; Sun, 30 Aug 2020 17:39:36 -0400 Original-Received: from zimbra.cs.ucla.edu ([131.179.128.68]:56418) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCV31-0008Aj-9a for 26911@debbugs.gnu.org; Sun, 30 Aug 2020 17:39:35 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id BF67D16008A; Sun, 30 Aug 2020 14:39:29 -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 kpB-pB3dAk-I; Sun, 30 Aug 2020 14:39:28 -0700 (PDT) Original-Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id DFD451600EA; Sun, 30 Aug 2020 14:39:28 -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 MWeZcfggfSMM; Sun, 30 Aug 2020 14:39:28 -0700 (PDT) Original-Received: from [192.168.1.9] (cpe-75-82-69-226.socal.res.rr.com [75.82.69.226]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id A8ACE16008A; Sun, 30 Aug 2020 14:39:28 -0700 (PDT) Autocrypt: addr=eggert@cs.ucla.edu; prefer-encrypt=mutual; keydata= LS0tLS1CRUdJTiBQR1AgUFVCTElDIEtFWSBCTE9DSy0tLS0tCgptUUlOQkV5QWNtUUJFQURB QXlIMnhvVHU3cHBHNUQzYThGTVpFb243NGRDdmM0K3ExWEEySjJ0QnkycHdhVHFmCmhweHhk R0E5Smo1MFVKM1BENGJTVUVnTjh0TFowc2FuNDdsNVhUQUZMaTI0NTZjaVNsNW04c0thSGxH ZHQ5WG0KQUF0bVhxZVpWSVlYL1VGUzk2ZkR6ZjR4aEVtbS95N0xiWUVQUWRVZHh1NDd4QTVL aFRZcDVibHRGM1dZRHoxWQpnZDdneDA3QXV3cDdpdzdlTnZub0RUQWxLQWw4S1lEWnpiRE5D UUdFYnBZM2VmWkl2UGRlSStGV1FONFcra2doCnkrUDZhdTZQcklJaFlyYWV1YTdYRGRiMkxT MWVuM1NzbUUzUWpxZlJxSS9BMnVlOEpNd3N2WGUvV0szOEV6czYKeDc0aVRhcUkzQUZINmls QWhEcXBNbmQvbXNTRVNORnQ3NkRpTzFaS1FNcjlhbVZQa25qZlBtSklTcWRoZ0IxRApsRWR3 MzRzUk9mNlY4bVp3MHhmcVQ2UEtFNDZMY0ZlZnpzMGtiZzRHT1JmOHZqRzJTZjF0azVlVThN Qml5Ti9iClowM2JLTmpOWU1wT0REUVF3dVA4NGtZTGtYMndCeHhNQWhCeHdiRFZadWR6eERa SjFDMlZYdWpDT0pWeHEya2wKakJNOUVUWXVVR3FkNzVBVzJMWHJMdzYrTXVJc0hGQVlBZ1Jy NytLY3dEZ0JBZndoU In-Reply-To: <83eenoxm18.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:186726 Archived-At: On 8/30/20 7:09 AM, Eli Zaretskii wrote: > you alluded to another use case, unrelated to > remote file names, but didn't provide any details. Here's an example. On RHEL 7.8 (file-symlink-p "/bin/.") returned "usr/bin" which was a bug since "/bin/." is not (and cannot possibly be) a symbolic link. This bug occurred because file-symlink-p calls expand-file-name which incorrectly stripped trailing "/." from the file name before checking the file's status. This sort of behavior broke code in startup.el that used file-attributes (which had the same bug) to compare $PWD to the working directory's name, which is how I ran into the bug again. (I vaguely recall running into this bug earlier but lacked time/energy then to track it down and fix it.) > Is that other use case really similar to the one > which started this bug report I expect they're related if we look at the mess inside file-attributes. They may not appear to be similar to users who don't know how Emacs is implemented. > I see no reason to require expand-file-name to preserve the > trailing slash It's required because trailing slash affects how file names are interpreted on GNU and other POSIXish platforms. Emacs should not second-guess GNU and POSIX on this: it should interpret file names like the underlying platforms do, as anything else would be unnecessarily confusing. > IMO the problem is immediately following the above snippet: > > /* Keep initial / only if this is the whole name. */ > if (o == target && IS_ANY_SEP (*o) && p[3] == 0) > ++o; > > This is very easy to fix without affecting any other uses of the > function: we should consider one other case in addition to "only if / > is the whole name" -- the case where this fails to DTRT with remote > directories. Such a fix should be no problem for the GNU/POSIXish side, as that snippet is in the DOS_NT code and any fixes there should affect only MS-Windows and DOS. I don't know what a "remote directory" is in that context, though, so I can't give specific advice. > Its code is complex and full of subtle dark > corners, many of which are not well covered by our test suite. expand-file-name is more complex than it needs to be, and its dark corners would be less dark if we cleaned it up a bit. In refactoring I would not attempt elegance, only understandability. Right now the code is needlessly hard to understand, and that makes it hard to fix - something I encountered while trying to fix some of the abovementioned bugs.