From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dima Kogan Newsgroups: gmane.emacs.bugs Subject: bug#54542: 29.0.50; dired can't visit a local directory if another buffer visits an unreachable remote (TRAMP) directory Date: Thu, 24 Mar 2022 00:15:10 -0700 Message-ID: <87r16rstxd.fsf@secretsauce.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18437"; mail-complaints-to="usenet@ciao.gmane.io" To: 54542@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Mar 24 08:16:27 2022 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 1nXHhp-0004WX-62 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Mar 2022 08:16:27 +0100 Original-Received: from localhost ([::1]:33300 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nXHho-0003cj-06 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Mar 2022 03:16:24 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38552) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXHhS-0003cL-Pa for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 03:16:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nXHhS-0004op-GC for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 03:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nXHhS-0004EA-Bm for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 03:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dima Kogan Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Mar 2022 07:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 54542 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.164810612416201 (code B ref -1); Thu, 24 Mar 2022 07:16:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Mar 2022 07:15:24 +0000 Original-Received: from localhost ([127.0.0.1]:46684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXHgq-0004DE-IS for submit@debbugs.gnu.org; Thu, 24 Mar 2022 03:15:24 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59374) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nXHgo-0004D3-F2 for submit@debbugs.gnu.org; Thu, 24 Mar 2022 03:15:22 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXHgn-0003Uu-5h for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 03:15:21 -0400 Original-Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:42841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nXHgl-0004Fm-1g for bug-gnu-emacs@gnu.org; Thu, 24 Mar 2022 03:15:20 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A97F23200953 for ; Thu, 24 Mar 2022 03:15:15 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 24 Mar 2022 03:15:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secretsauce.net; h=cc:content-type:date:date:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to; s=fm3; bh=J kuG5qnN3SJ0MlnYjYapEoAeIU/A6xkTY9CLT0bJAiE=; b=Ve6j6Sj3kdLoial/8 kziNIgUapUbGMds42DrfGRnZW1sY/FPLEfdLJa9wl7nZwU3TuRTx1+CrEPFHsEg0 cDfLHF/q41RnD2q7K06chm25xaJ8khbi1cKZBUc6PwvmkMxoC4wO4iCrqGf+Goff Y510CbeL2eunOyPDwpeNyJIRuuvMR4TFiHKZ1TqWCnAa8FgAJUo34uPKaSpc6zNV BUSbyS4lpwJRIxm27sLqbup68beDBIbtOjfV4h5kL9BK9EOSkVwj9A5/b5yVmv+d FTvWyM97UbpcV1yTRXyMde7kNjrsY5zFJtfixUmUrkqO+NB0TH24e1ZugYexDCv2 djCVw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=JkuG5qnN3SJ0MlnYjYapEoAeIU/A6xkTY9CLT0bJA iE=; b=Pu+Kpjnmps9d56yrLrPbAefe1gUXUZmE+TLCbmP/UxBBnVw+RV5hTP4sL nrl7a1WL33Ktwjv6UgpBZBdXxxVjo5cSHIOLa+Y4dYlfjsNzXjOuiRZAOqASxwr/ PHUguZGtEDDi+GBh9ypIDc8AQnFZB+mOkNAUxI7uS2PXV6ccpWr0NhvatMuWn0Ve x1YYxkrwDCyHseiXuY/N9DteIMnF07/ZgPNhjH0VX3JFZ7oyiLxEKpXZ2EW9PvKX +KenNfnFKQMPCrvKLa9iR6kl0v+sw2Tq4GQBZWt75UAm7t5Y2TvSJt/1MiZbzInD m0lNGnlNOVGLABuxzIOH4ULSTi5cg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrudegkedguddtjecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkfggtgesthdtredttd dttdenucfhrhhomhepffhimhgrucfmohhgrghnuceoughimhgrsehsvggtrhgvthhsrghu tggvrdhnvghtqeenucggtffrrghtthgvrhhnpeffvdffudfhkeffhfeifefhffdvtdfgfe ejveeuvdefudejjeduveeftdeggeeuvdenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpeguihhmrgesshgvtghrvghtshgruhgtvgdrnhgvth X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 24 Mar 2022 03:15:14 -0400 (EDT) Received-SPF: pass client-ip=64.147.123.19; envelope-from=dima@secretsauce.net; helo=wout3-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:228860 Archived-At: Hi. This sounds convoluted, but it's a real-life bug I hit repeatedly. Recipe: 1. emacs -Q 2. C-x C-f /ssh:host:directory Visit some remote directory via TRAMP. This opens a dired buffer 3. Unplug the network cable. Or walk away from wifi. Or turn off the remote host. Optionally, do other stuff with emacs. The bug is hit if the buffer in step 2 is open somewhere; doesn't have to be visible 4. C-x C-f /some/local/directory One would expect step 4 to work just fine because it's a local directory, so no TRAMP business should affect it, but it does. Step 4 will try to connect to the host in step 2. But that host is gone, so it'll fail, and step 4 will fail too. The problem is here: (defun dired-find-buffer-nocreate (dirname &optional mode) .... (let (found (blist dired-buffers)) ... (while blist ... (with-current-buffer (cdr (car blist)) .... (expand-file-name (if (consp dired-directory) (car dired-directory) dired-directory)))) Here dired is trying to figure out if we're already visiting the requested directory. In doing so, it loops through all extant dired buffers, and runs (expand-file-name) on each one. Running (expand-file-name) on a remote directory will try to contact the host. I'm not attaching a patch because I'm not 100% sure what's appropriate. I guess we want to replace (expand-file-name dired-directory) with something like this pseudo-code (concat (tramp-host dired-directory) (expand-file-name (tramp-filename dired-directory))) Except, thinking about edge cases: making sure this works with/without TRAMP, making sure relative directories work right, etc, etc. Do we already have a function that does this? Thanks!