From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#26911: 25.2; eshell "cd .." doesn't work correctly with TRAMP Date: Sun, 30 Aug 2020 17:09:55 +0300 Message-ID: <83eenoxm18.fsf@gnu.org> 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> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26967"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 26911@debbugs.gnu.org, mattiase@acm.org, michael.albinus@gmx.de, yegortimoshenko@gmail.com To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 30 16:11:09 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 1kCO33-0006u0-0s for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Aug 2020 16:11:09 +0200 Original-Received: from localhost ([::1]:40280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCO32-0000uY-3b for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Aug 2020 10:11:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kCO2v-0000uO-Uc for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 10:11:01 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38910) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kCO2v-0005I3-Lw for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 10:11:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kCO2v-0003sD-He for bug-gnu-emacs@gnu.org; Sun, 30 Aug 2020 10:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 30 Aug 2020 14:11: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.159879661114825 (code B ref 26911); Sun, 30 Aug 2020 14:11:01 +0000 Original-Received: (at 26911) by debbugs.gnu.org; 30 Aug 2020 14:10:11 +0000 Original-Received: from localhost ([127.0.0.1]:50456 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCO26-0003r3-Tk for submit@debbugs.gnu.org; Sun, 30 Aug 2020 10:10:11 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:33940) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCO22-0003qZ-QX for 26911@debbugs.gnu.org; Sun, 30 Aug 2020 10:10:09 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:40103) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kCO1x-00054n-Cg; Sun, 30 Aug 2020 10:10:01 -0400 Original-Received: from [176.228.60.248] (port=1728 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kCO1w-0007yv-Re; Sun, 30 Aug 2020 10:10:01 -0400 In-Reply-To: <164450fe-7f86-e336-87d4-13c52e52c61c@cs.ucla.edu> (message from Paul Eggert on Sat, 29 Aug 2020 13:42:23 -0700) 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:186694 Archived-At: > Cc: 26911@debbugs.gnu.org, mattiase@acm.org, michael.albinus@gmx.de, > yegortimoshenko@gmail.com > From: Paul Eggert > Date: Sat, 29 Aug 2020 13:42:23 -0700 > > It surely would be better to fix the bug on MS-Windows. A good way to start > doing that is to refactor the code a bit to avoid the tricky #ifdefs it > currently uses, as these #ifdefs make bugs like this painful to fix. I can draft > a patch along those lines if you like. I realize you're dubious about > refactoring and so wouldn't install the patch without checking with you. It isn't right for us to make significant changes in expand-file-name, let alone refactor it. Its code is complex and full of subtle dark corners, many of which are not well covered by our test suite. Refactoring it into something more elegant is a large job -- for a very small gain, since the function does its job 99.99% of the time. We would be wasting our sparse resources if we do any serious changes there, and will almost certainly introduce quite a few bugs on the way. It isn't worth it, definitely not in order to fix the couple of rare bugs we are facing. Instead, we should fix these particular bugs by localized changes whose effect is limited to the specific situations we need to fix. So with that in mind, let's please go back to the problems we have and see how they can be fixed without unnecessary refactoring. The original problem in this bug report was identified by Michael: > In fileio.c, lines 1393-1394, the following loop > > --8<---------------cut here---------------start------------->8--- > while (o != target && (--o, !IS_DIRECTORY_SEP (*o))) > continue; > --8<---------------cut here---------------end--------------->8--- > > replaces "/ssh:host:/bin/.." by "/ssh:host:". But it should be > "/ssh:host:/". Actually, 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. In your log message you alluded to another use case, unrelated to remote file names, but didn't provide any details. Can you please provide them now? Is that other use case really similar to the one which started this bug report (if not, no need to fix them both together)? The related bug#34834 is again about remote file names, but it's a different situation. AFAICT, it should also be easy to fix in a localized manner. Making such localized changes will allow us to be certain we don't break any use cases we already support successfully. Finally, I see no reason to require expand-file-name to preserve the trailing slash -- we never required this until now, and AFAIK had no problems with that. If some specialized use case does need this, I'd prefer to fix that only where and when it really matters. For example, if some Eshell command needs it, let's first consider fixing that in Eshell. In any case, the trailing slash issue is only tangentially related to the bugs discussed here, so let's not mix these separate issues. Thanks.