From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#31489: 25.3; Dired unable to open directory "/ssh:example.com" Date: Fri, 18 May 2018 17:25:17 +0200 Message-ID: <87zi0xkmua.fsf@gmx.de> References: <1526643719.9043.13.camel@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1526657049 10769 195.159.176.226 (18 May 2018 15:24:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 18 May 2018 15:24:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 31489@debbugs.gnu.org To: Christoph Michelbach Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 18 17:24:05 2018 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 1fJhEh-0002eq-Rc for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 17:24:04 +0200 Original-Received: from localhost ([::1]:39525 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJhGo-0000eg-VU for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 May 2018 11:26:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fJhGh-0000eY-LI for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 11:26:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fJhGc-0000sN-Ir for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 11:26:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:60279) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fJhGc-0000sB-Cj for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 11:26:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fJhGc-00051y-6q for bug-gnu-emacs@gnu.org; Fri, 18 May 2018 11:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 18 May 2018 15:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 31489 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 31489-submit@debbugs.gnu.org id=B31489.152665712719298 (code B ref 31489); Fri, 18 May 2018 15:26:02 +0000 Original-Received: (at 31489) by debbugs.gnu.org; 18 May 2018 15:25:27 +0000 Original-Received: from localhost ([127.0.0.1]:39943 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJhG3-00051C-D6 for submit@debbugs.gnu.org; Fri, 18 May 2018 11:25:27 -0400 Original-Received: from mout.gmx.net ([212.227.17.21]:33827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fJhG1-00050y-J0 for 31489@debbugs.gnu.org; Fri, 18 May 2018 11:25:26 -0400 Original-Received: from detlef.gmx.de ([212.86.47.102]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MhMg2-1ex41t0IbK-00MgUu; Fri, 18 May 2018 17:25:19 +0200 In-Reply-To: <1526643719.9043.13.camel@gmail.com> (Christoph Michelbach's message of "Fri, 18 May 2018 13:41:59 +0200") X-Provags-ID: V03:K1:UWjZlsZmfHau9dHwKYzAUaxpXPpSqzJlHEHnPycIgd2B+eRijAG TbvTbahYFowNHq5Ywjm6z/TP2JjpHp1KFe7QB0XB8gZNTwpSDZIXaujdQhf2cpj47IaIH3t MCvxxkjD9E7XJ3h7L4i785k17hjrDGeuX8UOV06Dr6ZeKjzMDPj+uRz/k0+yqI16xRYXPPJ AC6ykVUMhRWnFpbjtVnXw== X-UI-Out-Filterresults: notjunk:1;V01:K0:iTt/EYwdBvw=:nNLdtiSq6D6MJxjEX4CUFe 8MvmXrCYXccoM/P95vFTZPTYArNz81dOGgK/56fKr2F4uQs4CZmLz/rItzjJNYsMNtL1KpSEU BpZBDrv562XyfGZjZPZ49fuZRZ7gy3xW9HfNRcSYeOLua7CPFzd7+yRazK/z+jg8yRO+SlJCi ZLP95T/FuADEaJxcK0ObV9YZl59IoY3ZtflnGJCYlKus2iPy1X70tLEvbC/HXAJOZWW/YE/DE 8sUafGXi0mcbnYMLon4+nrpncKXlQnWKqVQblKfmcKQ2lPhVd8dupXqm0OnFWF8eD4E4CtvUL Afh5MWMPMk/S3AntPcD7etFdDrqZtLUsHdNIQQNTLoyWATw9fga7KfAfxtOzgsmgwmRG8pXqt UxRW8Y2HAp4/y8u/zISpwpVgWJaFa6bb6+nD/CeYfpxGLdEFb+ECoMsmCKgG5VI02K7frwH4W Omzg3D9gOMJswRHukx6AraUTvxfG2e9tPo39Y4KZDHVAvL5NNVa8ytVklSFvTZrygPfS0YS7Z 6mjgET2ebSrZV55DWmSC6RM4a4k1RHiMGGe60NW9d6rqqrdBagSciM5ReqJc65FOq5t02AQbm 9xQZzI8X/2PFxmL78vwho8NSPlJWJhmntkcBO94BBWXuTKJJ7G1Its5lpwBydZF7tP6AFtHfX QybPS1bzjci2AGdcIXcIL+MfvkpXny+RZM9Xr718No7o6sjokszlrM3k0bq7MeiSf/JpGCjMR 6s0TYdtwnXmOqqtVnWvU7QqJ+HjGpucq9hgH8cfYU05aRLMFYYYWehAnU1A= 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:146261 Archived-At: --=-=-= Content-Type: text/plain Christoph Michelbach writes: Hi Christoph, > When a file's path conflicts with how an external resource is > addressed, you can tell Emacs to open the local path by preceding it > with "/:". If you created a file with > > sudo touch "/ssh:example.com/file" > > , you could access it via: > > C-x C-f /:/ssh:example.com/file RET > > However, if you leave "file" out, you don't get to see a dired buffer after > hitting return. Instead, the current windows are retained and the mini buffer > reads: > > Host name must not match method "ssh" Thanks for the bug report. The appended patch, towards the master branch of the Emacs repository, fixes it for me. Could you pls check? > You also cannot first navigate to "/" and then enter the directory by moving > point to it and hitting return. The same problem accompanied by the same error > message occurs. You should navigate to "/:". Then it works, after applying the patch. However, before committing the patch I need to run further tests. The patch let tramp-tests.el fail, which must be investigated further. Best regards, Michael. --=-=-= Content-Type: text/plain Content-Disposition: attachment diff --git a/lisp/files.el b/lisp/files.el index d98d09bb1e..2478a22046 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -7056,7 +7056,8 @@ file-name-non-special '(nil 0)))) method ;; Copy ARGUMENTS so we can replace elements in it. - (arguments (copy-sequence arguments))) + (arguments (copy-sequence arguments)) + file-name-handler-alist) (if (symbolp (car file-arg-indices)) (setq method (pop file-arg-indices))) ;; Strip off the /: from the file names that have it. @@ -7064,27 +7065,20 @@ file-name-non-special (while (consp file-arg-indices) (let ((pair (nthcdr (car file-arg-indices) arguments))) (and (car pair) - (string-match "\\`/:" (car pair)) - (setcar pair - (if (= (length (car pair)) 2) - "/" - (substring (car pair) 2))))) + (setcar pair (file-name-unquote (car pair))))) (setq file-arg-indices (cdr file-arg-indices)))) (pcase method (`identity (car arguments)) (`add (file-name-quote (apply operation arguments))) (`buffer-file-name - (let ((buffer-file-name - (if (string-match "\\`/:" buffer-file-name) - (substring buffer-file-name (match-end 0)) - buffer-file-name))) + (let ((buffer-file-name (file-name-unquote buffer-file-name))) (apply operation arguments))) (`insert-file-contents (let ((visit (nth 1 arguments))) (unwind-protect (apply operation arguments) (when (and visit buffer-file-name) - (setq buffer-file-name (concat "/:" buffer-file-name)))))) + (setq buffer-file-name (file-name-quote buffer-file-name)))))) (`unquote-then-quote ;; We can't use `cl-letf' with `(buffer-local-value)' here ;; because it wouldn't work during bootstrapping. @@ -7093,7 +7087,7 @@ file-name-non-special ;; `verify-visited-file-modtime' action, which takes a buffer ;; as only optional argument. (with-current-buffer (or (car arguments) buffer) - (let ((buffer-file-name (substring buffer-file-name 2))) + (let ((buffer-file-name (file-name-unquote buffer-file-name))) ;; Make sure to hide the temporary buffer change from the ;; underlying operation. (with-current-buffer buffer --=-=-=--