From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#33791: 26.1; Eshell on Windows connecting to GNU/Linux machine using TRAMP and plink: env: =?UTF-8?Q?=E2=80=98c:/home/jordan/test.sh=E2=80=99:?= No such file or directory Date: Sun, 23 Dec 2018 17:58:36 +0200 Message-ID: <83woo08cb7.fsf@gnu.org> References: <87pntyanho.fsf@gmx.com> <83zhsxap9i.fsf@gnu.org> <875zvluaby.fsf@gmx.de> <83r2e9alte.fsf@gnu.org> <87woo0s9g1.fsf@gmx.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1545580698 5766 195.159.176.226 (23 Dec 2018 15:58:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 23 Dec 2018 15:58:18 +0000 (UTC) Cc: 33791@debbugs.gnu.org, michael.albinus@gmx.de To: Jordan Wilson Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Dec 23 16:58:13 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 1gb68r-0001NK-BW for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2018 16:58:13 +0100 Original-Received: from localhost ([::1]:49061 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gb6Ay-0005uv-8m for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2018 11:00:24 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gb6Ag-0005pl-Gj for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 11:00:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gb6Ac-0008De-K8 for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 11:00:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57893) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gb6Ac-0008DQ-Fr for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 11:00:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gb6Ac-0004DZ-8s for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2018 11:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Dec 2018 16:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 33791 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 33791-submit@debbugs.gnu.org id=B33791.154558074116107 (code B ref 33791); Sun, 23 Dec 2018 16:00:02 +0000 Original-Received: (at 33791) by debbugs.gnu.org; 23 Dec 2018 15:59:01 +0000 Original-Received: from localhost ([127.0.0.1]:33918 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gb69d-0004Bf-51 for submit@debbugs.gnu.org; Sun, 23 Dec 2018 10:59:01 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:42830) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gb69b-0004BS-2m for 33791@debbugs.gnu.org; Sun, 23 Dec 2018 10:58:59 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gb69U-00075Z-RA for 33791@debbugs.gnu.org; Sun, 23 Dec 2018 10:58:53 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gb69Q-00072D-2L; Sun, 23 Dec 2018 10:58:48 -0500 Original-Received: from [176.228.60.248] (port=2294 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gb69P-0000LP-LB; Sun, 23 Dec 2018 10:58:48 -0500 In-reply-to: <87woo0s9g1.fsf@gmx.com> (message from Jordan Wilson on Sun, 23 Dec 2018 12:40:14 +0000) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:153790 Archived-At: > From: Jordan Wilson > Cc: 33791@debbugs.gnu.org, michael.albinus@gmx.de > Date: Sun, 23 Dec 2018 12:40:14 +0000 > > Hmm...seems the bug I'm experiencing is more low-lying than eshell. I've > followed it down to C-level. eshell/cd -> cd -> locate-file -> > locate-file-internal. In my case both problems arise from "c:" > being prepended somewhere. > > Evaluating: > > (locate-file-internal ".." '("./") nil (lambda (f) (message f))) > > while in "/plink:jordan@domain.com:/home/jordan/test" returns > "c:/plink:jordan@domain.com:/home/jordan". Whilst > > (locate-file-internal ".." > '("/plink:jordan@domain.com:/home/jordan/test") > nil (lambda (f) (message f))) > > correctly returns "/plink:jordan@domain.com:/home/jordan". > > It seems the problem is something to do with converting from a > relative to absolute path. Eval'ing (expand-file-name "..") correctly > returns "/plink:jordan@domain.com:/home/jordan", though. Strange. Right you are, thanks. The problem is that locate-file doesn't support remote file names. Does the patch below produce good results? Michael, do you agree with this solution? Do you think it's safe enough to put it on the release branch (it's a regression from a few years ago)? diff --git a/lisp/files.el b/lisp/files.el index eb09a7c..cfe67b4 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -801,9 +801,15 @@ cd (setq cd-path (or (parse-colon-path (getenv "CDPATH")) (list "./")))) (cd-absolute - (or (locate-file dir cd-path nil - (lambda (f) (and (file-directory-p f) 'dir-ok))) - (error "No such directory found via CDPATH environment variable")))) + (or + ;; locate-file doesn't support remote file names, so detect them + ;; and support them here by hand. + (and (file-name-absolute-p (expand-file-name dir)) + (file-accessible-directory-p (expand-file-name dir)) + (expand-file-name dir)) + (locate-file dir cd-path nil + (lambda (f) (and (file-directory-p f) 'dir-ok))) + (error "No such directory found via CDPATH environment variable")))) (defun directory-files-recursively (dir regexp &optional include-directories) "Return list of all files under DIR that have file names matching REGEXP.