bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#33791: 26.1; Eshell on Windows connecting to GNU/Linux machine using


From: Michael Albinus
Subject: bug#33791: 26.1; Eshell on Windows connecting to GNU/Linux machine using TRAMP and plink: env: ‘c:/home/jordan/test.sh’: No such file or directory
Date: Thu, 27 Dec 2018 14:33:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

Hi Eli,

>> Evaluating:
>> 
>>      (locate-file-internal ".." '("./") nil (lambda (f) (message f)))
>> 
>> while in "/plink:address@hidden:/home/jordan/test" returns
>> "c:/plink:address@hidden:/home/jordan". Whilst
>> 
>>      (locate-file-internal ".."
>>             '("/plink:address@hidden:/home/jordan/test")
>>              nil (lambda (f) (message f)))
>> 
>> correctly returns "/plink:address@hidden:/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:address@hidden:/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)?

I've tried to debug it, but no chance to do it on Windows.
Debugging C sources is a no-go for me there.

> 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.

Works for me, also on Windows, but I have modified it slightly in order
to make it more explicit. I have applied

> +   (or
> +    ;; locate-file doesn't support remote file names, so detect them
> +    ;; and support them here by hand.
> +    (and (file-remote-p (expand-file-name dir))
...

It is also OK for me to push it to the emacs-26 branch.

Best regards, Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]