unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
@ 2019-04-12  2:44 Shuguang Sun
  0 siblings, 0 replies; 21+ messages in thread
From: Shuguang Sun @ 2019-04-12  2:44 UTC (permalink / raw)
  To: 35241

Hi,

I use .authinfo.gpg to store my login information, instead of .authinfo. 

Whe I open /plink:... with tramp, emacs get blocked and it seems tramp
is dealing with .authinfo, and it doesn't decrypt the file. I need open
.authinfo.gpg first, which means emacs can read .authinfo.gpg whithout
interaction (passphrase?), and then tramp can do the following action
(e.g., login...), and messaging 
"Decrypting c:/Users/username/HOME/.authinfo.gpg...done".

Gnus works well, and it can interact with passphrase and ask for the
password for .authinfo.gpg.


In GNU Emacs 27.0.50 (build 3, x86_64-w64-mingw32)
 of 2019-04-05 built on RSHMX11052
Repository revision: a68c96863289d5d8ccfc2f775d0018a2721c5e53
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.15063
System Description: Microsoft Windows 10 Enterprise (v10.0.1703.15063.1689)


Configured using:
 'configure --without-imagemagick --without-pop
 '--program-transform-name=s/^ctags$/ctags.emacs/'
 PKG_CONFIG_PATH=/mingw64/lib/pkgconfig:/mingw64/share/pkgconfig'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
ZLIB TOOLKIT_SCROLL_BARS THREADS JSON PDUMPER LCMS2 GMP

Important settings:
  value of $LANG: CHS
  locale-coding-system: cp936








^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
       [not found] <vk5yimvkeyca.fsf@qq.com>
@ 2019-04-16  1:20 ` Noam Postavsky
  2019-04-16  4:54   ` Shuguang Sun
  0 siblings, 1 reply; 21+ messages in thread
From: Noam Postavsky @ 2019-04-16  1:20 UTC (permalink / raw)
  To: Shuguang Sun; +Cc: 35241

Shuguang Sun <shuguang79@qq.com> writes:

> I use .authinfo.gpg to store my login information, instead of .authinfo. 
>
> Whe I open /plink:... with tramp, emacs get blocked and it seems tramp
> is dealing with .authinfo

Can you get a backtrace with M-x toggle-debug-on-quit, and then hitting
C-g when it's stuck?






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16  1:20 ` Noam Postavsky
@ 2019-04-16  4:54   ` Shuguang Sun
  2019-04-16  7:18     ` Michael Albinus
  0 siblings, 1 reply; 21+ messages in thread
From: Shuguang Sun @ 2019-04-16  4:54 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: 35241

Noam Postavsky <npostavs@gmail.com> writes:

> Shuguang Sun <shuguang79@qq.com> writes:
>
>> I use .authinfo.gpg to store my login information, instead of .authinfo. 
>>
>> Whe I open /plink:... with tramp, emacs get blocked and it seems tramp
>> is dealing with .authinfo
>
> Can you get a backtrace with M-x toggle-debug-on-quit, and then hitting
> C-g when it's stuck?
>
>

Below is part of the message. It seems it try to find "gpg2", and there is no "gpg2".
Actually, I have gpg version gpg (GnuPG) 2.2.15, and epg-gpg-program as "gpg".

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (quit)
  tramp-accept-process-output(#<process *tramp/plink username@host.com*>)
  tramp-wait-for-regexp(#<process *tramp/plink username@host.com*> nil "\\(^\\|\0\\)[^#$\n]*///92fc211a5...")
  tramp-wait-for-output(#<process *tramp/plink username@host.com*>)
  tramp-send-command((tramp-file-name "plink" "username" nil "host.com" nil "./." nil) "cd ~ && pwd")
  tramp-sh-handle-expand-file-name("." "/plink:username@host.com:")
  apply(tramp-sh-handle-expand-file-name ("." "/plink:username@host.com:"))
  tramp-sh-file-name-handler(expand-file-name "." "/plink:username@host.com:")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/plink:username@host.com:"))
  tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
  locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
  executable-find("gpg2")
  epg-find-configuration(OpenPGP)
  epg-context--make(OpenPGP nil nil nil nil nil nil)
  epg-make-context()
  epa-file-insert-file-contents("c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil)
  apply(epa-file-insert-file-contents ("c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil))
  epa-file-handler(insert-file-contents "c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil)
  insert-file-contents("~/.authinfo.gpg")
  auth-source-netrc-parse(:max 1 :require (:secret :user) :file "~/.authinfo.gpg" :host "host.com" :user "username" :port "plink")
  auth-source-netrc-search(:backend #<auth-source-backend auth-source-backend-29bf9d8> :type netrc :max 1 :require (:secret :user) :create nil :delete nil :max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t)
  apply(auth-source-netrc-search :backend #<auth-source-backend auth-source-backend-29bf9d8> :type netrc :max 1 :require (:secret :user) :create nil :delete nil (:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t))
  auth-source-search-backends((#<auth-source-backend auth-source-backend-29bf988> #<auth-source-backend auth-source-backend-29bf9d8> #<auth-source-backend auth-source-backend-29bfa1c>) (:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t) 1 nil nil (:secret :user))
  auth-source-search(:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t)
  tramp-read-passwd(#<process *tramp/plink username@host.com*>)
  tramp-action-password(#<process *tramp/plink username@host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil))
--8<---------------cut here---------------end--------------->8---


-- 
Best Regards
Shuguang Sun







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16  4:54   ` Shuguang Sun
@ 2019-04-16  7:18     ` Michael Albinus
  2019-04-16  9:34       ` Shuguang Sun
                         ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-16  7:18 UTC (permalink / raw)
  To: Shuguang Sun; +Cc: 35241, Noam Postavsky

Shuguang Sun <shuguang79@qq.com> writes:

Hi,

> Below is part of the message. It seems it try to find "gpg2", and
> there is no "gpg2".

Yes.

>   tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
>   locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
>   executable-find("gpg2")

This is the crucial part. `executable-find' shall operate on the local
file system only. But it calls `locate-file-internal' with a PATH
pointing to remote.

I suppose you have edited the backtrace, and written (list of path).
What is there? My crystal ball tells me it contains "." ...

Best regards, Michael.






^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16  7:18     ` Michael Albinus
@ 2019-04-16  9:34       ` Shuguang Sun
  2019-04-16  9:42       ` Shuguang Sun
       [not found]       ` <vk5y5zrei997.fsf@qq.com>
  2 siblings, 0 replies; 21+ messages in thread
From: Shuguang Sun @ 2019-04-16  9:34 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 35241, Noam Postavsky

Michael Albinus <michael.albinus@gmx.de> writes:

> Shuguang Sun <shuguang79@qq.com> writes:
>
> Hi,
>
>> Below is part of the message. It seems it try to find "gpg2", and
>> there is no "gpg2".
>
> Yes.
>
>>   tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
>>   locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
>>   executable-find("gpg2")
>
> This is the crucial part. `executable-find' shall operate on the local
> file system only. But it calls `locate-file-internal' with a PATH
> pointing to remote.
>
> I suppose you have edited the backtrace, and written (list of path).
> What is there? My crystal ball tells me it contains "." ...

Sorry. I do modified it here. It is the local path, not remote. And it contains "." which looks like:

--8<---------------cut here---------------start------------->8---
  locate-file("gpg2" ("." "C:/Users/username/emacs/bin/" "C:/Users/username/scoop/apps/gnupg/current/bin/" "C:/Users/username/scoop/shims/" "C:/Users/username/Progs/msys64/mingw64/bin/" "C:/Users/username/Progs/msys64/usr/bin/" "C:/Users/username/Progs/miktex-portable/texmfs/insta..." "C:/Users/username/AppData/Local/Microsoft/WindowsApp...") (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
--8<---------------cut here---------------end--------------->8---

I have gpg installed and can be executable-find.

>
> Best regards, Michael.
>
>

-- 
Best Regards
Shuguang Sun







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16  7:18     ` Michael Albinus
  2019-04-16  9:34       ` Shuguang Sun
@ 2019-04-16  9:42       ` Shuguang Sun
       [not found]       ` <vk5y5zrei997.fsf@qq.com>
  2 siblings, 0 replies; 21+ messages in thread
From: Shuguang Sun @ 2019-04-16  9:42 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 35241, Noam Postavsky

Michael Albinus <michael.albinus@gmx.de> writes:

> Shuguang Sun <shuguang79@qq.com> writes:
>
> Hi,
>
>> Below is part of the message. It seems it try to find "gpg2", and
>> there is no "gpg2".
>
> Yes.
>
>>   tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
>>   locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
>>   executable-find("gpg2")
>
> This is the crucial part. `executable-find' shall operate on the local
> file system only. But it calls `locate-file-internal' with a PATH
> pointing to remote.
>
> I suppose you have edited the backtrace, and written (list of path).
> What is there? My crystal ball tells me it contains "." ...
>
> Best regards, Michael.
>
>

Here is the full trace. I'm sorry for my mistake in previous messages.

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (quit)
  tramp-accept-process-output(#<process *tramp/plink username@host.com*>)
  tramp-wait-for-regexp(#<process *tramp/plink username@host.com*> nil "\\(^\\|\0\\)[^#$\n]*///61c1f45b2851d8909126eda541bf6308...")
  tramp-wait-for-output(#<process *tramp/plink username@host.com*>)
  tramp-send-command((tramp-file-name "plink" "username" nil "host.com" nil "./." nil) "cd ~ && pwd")
  tramp-sh-handle-expand-file-name("." "/plink:username@host.com:")
  apply(tramp-sh-handle-expand-file-name ("." "/plink:username@host.com:"))
  tramp-sh-file-name-handler(expand-file-name "." "/plink:username@host.com:")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/plink:username@host.com:"))
  tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
  locate-file-internal("gpg2" ("." "C:/Users/username/emacs/bin/" "C:/Users/username/scoop/apps/r-openblas/current/bin/..." "C:/Users/username/scoop/apps/gnupg/current/bin/" "C:/Users/username/scoop/shims/" "C:/Users/username/Progs/winports/bin/" "c:/Users/username/AppData/Roaming/Python/Python37/Sc..." "C:/Users/username/Progs/Python37" "C:/Users/username/Progs/Python37/Scripts" "C:/Users/username/Progs/Python37/DLLS" "C:/Users/username/Progs/msys64/mingw64/bin/" "C:/Users/username/Progs/msys64/usr/bin/" "C:/Users/username/Progs/svn-win32/bin/" "C:/Users/username/Progs/mplayer-console/" "C:/Users/username/Progs/LanguageTool/" "c:/Program Files (x86)/Google/Chrome/Application/" "C:/Users/username/Progs/miktex-portable/texmfs/insta..." "C:/Users/username/scoop/apps/nodejs/current/bin/" "C:/Users/username/scoop/apps/nodejs/current/" "C:/Users/username/Progs/winports/emax/mingw64/bin" "c:/app/oracle/client11g/product/11.2.0/client/bin" "C:/Program Files (x86)/Java/jre6/bin" "C:/Program Files/Java/jre6/bin" "C:/WINDOWS/system32" "C:/WINDOWS" "C:/WINDOWS/System32/Wbem" "C:/WINDOWS/System32/WindowsPowerShell/v1.0/" "C:/Program Files/SAS 94TS1M1/Secure/ccme4" "C:/Program Files/SAS 94TS1M1/x86/Secure/ccme4" "C:/Users/username/scoop/apps/gnupg/current/bin" "C:/Users/username/scoop/shims" "C:/Users/username/AppData/Local/Microsoft/WindowsApp..." "c:/Users/username/emacs/libexec/emacs/27.0.50/x86_64...") (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
  locate-file("gpg2" ("." "C:/Users/username/emacs/bin/" "C:/Users/username/scoop/apps/r-openblas/current/bin/..." "C:/Users/username/scoop/apps/gnupg/current/bin/" "C:/Users/username/scoop/shims/" "C:/Users/username/Progs/winports/bin/" "c:/Users/username/AppData/Roaming/Python/Python37/Sc..." "C:/Users/username/Progs/Python37" "C:/Users/username/Progs/Python37/Scripts" "C:/Users/username/Progs/Python37/DLLS" "C:/Users/username/Progs/msys64/mingw64/bin/" "C:/Users/username/Progs/msys64/usr/bin/" "C:/Users/username/Progs/svn-win32/bin/" "C:/Users/username/Progs/mplayer-console/" "C:/Users/username/Progs/LanguageTool/" "c:/Program Files (x86)/Google/Chrome/Application/" "C:/Users/username/Progs/miktex-portable/texmfs/insta..." "C:/Users/username/scoop/apps/nodejs/current/bin/" "C:/Users/username/scoop/apps/nodejs/current/" "C:/Users/username/Progs/winports/emax/mingw64/bin" "c:/app/oracle/client11g/product/11.2.0/client/bin" "C:/Program Files (x86)/Java/jre6/bin" "C:/Program Files/Java/jre6/bin" "C:/WINDOWS/system32" "C:/WINDOWS" "C:/WINDOWS/System32/Wbem" "C:/WINDOWS/System32/WindowsPowerShell/v1.0/" "C:/Program Files/SAS 94TS1M1/Secure/ccme4" "C:/Program Files/SAS 94TS1M1/x86/Secure/ccme4" "C:/Users/username/scoop/apps/gnupg/current/bin" "C:/Users/username/scoop/shims" "C:/Users/username/AppData/Local/Microsoft/WindowsApp..." "c:/Users/username/emacs/libexec/emacs/27.0.50/x86_64...") (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)
  executable-find("gpg2")
  epg-find-configuration(OpenPGP)
  epg-context--make(OpenPGP nil nil nil nil nil nil)
  epg-make-context()
  epa-file-insert-file-contents("c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil)
  apply(epa-file-insert-file-contents ("c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil))
  epa-file-handler(insert-file-contents "c:/Users/username/HOME/.authinfo.gpg" nil nil nil nil)
  insert-file-contents("~/.authinfo.gpg")
  auth-source-netrc-parse(:max 1 :require (:secret :user) :file "~/.authinfo.gpg" :host "host.com" :user "username" :port "plink")
  auth-source-netrc-search(:backend #<auth-source-backend auth-source-backend-3160aac> :type netrc :max 1 :require (:secret :user) :create nil :delete nil :max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t)
  apply(auth-source-netrc-search :backend #<auth-source-backend auth-source-backend-3160aac> :type netrc :max 1 :require (:secret :user) :create nil :delete nil (:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t))
  auth-source-search-backends((#<auth-source-backend auth-source-backend-3160a34> #<auth-source-backend auth-source-backend-3160aac> #<auth-source-backend auth-source-backend-3160ae0>) (:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t) 1 nil nil (:secret :user))
  auth-source-search(:max 1 :user "username" :host "host.com" :port "plink" :require (:secret :user) :create t)
  tramp-read-passwd(#<process *tramp/plink username@host.com*>)
  tramp-action-password(#<process *tramp/plink username@host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil))
  tramp-process-one-action(#<process *tramp/plink username@host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) ((tramp-login-prompt-regexp tramp-action-login) (tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (shell-prompt-pattern tramp-action-succeed) (tramp-shell-prompt-pattern tramp-action-succeed) (tramp-yesno-prompt-regexp tramp-action-yesno) (tramp-yn-prompt-regexp tramp-action-yn) (tramp-terminal-prompt-regexp tramp-action-terminal) (tramp-process-alive-regexp tramp-action-process-alive)))
  tramp-process-actions(#<process *tramp/plink username@host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) 1 ((tramp-login-prompt-regexp tramp-action-login) (tramp-password-prompt-regexp tramp-action-password) (tramp-wrong-passwd-regexp tramp-action-permission-denied) (shell-prompt-pattern tramp-action-succeed) (tramp-shell-prompt-pattern tramp-action-succeed) (tramp-yesno-prompt-regexp tramp-action-yesno) (tramp-yn-prompt-regexp tramp-action-yn) (tramp-terminal-prompt-regexp tramp-action-terminal) (tramp-process-alive-regexp tramp-action-process-alive)) 180)
  tramp-maybe-open-connection((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil))
  tramp-send-command((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) "( (test -e /home/username/ || test -h /home/...")
  tramp-send-command-and-check((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) "( (test -e /home/username/ || test -h /home/...")
  tramp-barf-unless-okay((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) "( (test -e /home/username/ || test -h /home/..." "`%s' returns with error" "( (test -e /home/username/ || test -h /home/...")
  tramp-send-command-and-read((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) "( (test -e /home/username/ || test -h /home/...")
  tramp-do-file-attributes-with-stat((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) "/home/username/" string)
  tramp-sh-handle-file-attributes("/plink:username@host.com:/home/username/" string)
  apply(tramp-sh-handle-file-attributes ("/plink:username@host.com:/home/username/" string))
  tramp-sh-file-name-handler(file-attributes "/plink:username@host.com:/home/username/" string)
  apply(tramp-sh-file-name-handler file-attributes ("/plink:username@host.com:/home/username/" string))
  tramp-file-name-handler(file-attributes "/plink:username@host.com:/home/username/" string)
  file-attributes("/plink:username@host.com:/home/username/" string)
  tramp-check-cached-permissions((tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil) 114)
  tramp-sh-handle-file-readable-p("/plink:username@host.com:/home/username/")
  apply(tramp-sh-handle-file-readable-p "/plink:username@host.com:/home/username/")
  tramp-sh-file-name-handler(file-readable-p "/plink:username@host.com:/home/username/")
  apply(tramp-sh-file-name-handler file-readable-p "/plink:username@host.com:/home/username/")
  tramp-file-name-handler(file-readable-p "/plink:username@host.com:/home/username/")
  file-readable-p("/plink:username@host.com:/home/username/")
--8<---------------cut here---------------end--------------->8---




-- 
Best Regards
Shuguang Sun







^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
       [not found]       ` <vk5y5zrei997.fsf@qq.com>
@ 2019-04-16 12:50         ` Michael Albinus
  2019-04-16 14:47           ` Eli Zaretskii
                             ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-16 12:50 UTC (permalink / raw)
  To: Shuguang Sun; +Cc: 35241, Noam Postavsky

Shuguang Sun <shuguang79@qq.com> writes:

Hi,

>>>   tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
>>>   locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat"
>>> ".cmd" ".btm" "") 1)
>>>   executable-find("gpg2")
>>
>> This is the crucial part. `executable-find' shall operate on the local
>> file system only. But it calls `locate-file-internal' with a PATH
>> pointing to remote.
>>
>> I suppose you have edited the backtrace, and written (list of path).
>> What is there? My crystal ball tells me it contains "." ...
>
> Sorry. I do modified it here. It is the local path, not remote. And it
> contains "." which looks like:
>
>   locate-file("gpg2" ("." "C:/Users/username/emacs/bin/" "C:/Users/username/scoop/apps/gnupg/current/bin/" "C:/Users/username/scoop/shims/" "C:/Users/username/Progs/msys64/mingw64/bin/" "C:/Users/username/Progs/msys64/usr/bin/" "C:/Users/username/Progs/miktex-portable/texmfs/insta..." "C:/Users/username/AppData/Local/Microsoft/WindowsApp...") (".exe" ".com" ".bat" ".cmd" ".btm" "") 1)

Thanks, as I've expected. A relative file name like "." is the
problem. If the current directory is a remote one, it expands to a
remote directory inside exec-path, with all the hassle.

How does come "." into exec-path? Have you set this in your .emacs? Or
is it part of the PATH environment variable on your system? You know,
that it is discouraged to add "." to your PATH for security reasons.

Relative file names are not forbidden as part of exec-path. Shall we ban
them (with an error message)? Or shall we ignore them, silently? Don't know.

I'd vote for the latter (including proper documentation).

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 12:50         ` Michael Albinus
@ 2019-04-16 14:47           ` Eli Zaretskii
  2019-04-16 16:20             ` Michael Albinus
  2019-04-16 15:20           ` Noam Postavsky
                             ` (2 subsequent siblings)
  3 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2019-04-16 14:47 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, 35241, npostavs

> From: Michael Albinus <michael.albinus@gmx.de>
> Date: Tue, 16 Apr 2019 14:50:40 +0200
> Cc: 35241@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com>
> 
> Relative file names are not forbidden as part of exec-path. Shall we ban
> them (with an error message)? Or shall we ignore them, silently? Don't know.
> 
> I'd vote for the latter (including proper documentation).

Maybe executable-find should ignore them if default-directory is
remote?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 12:50         ` Michael Albinus
  2019-04-16 14:47           ` Eli Zaretskii
@ 2019-04-16 15:20           ` Noam Postavsky
  2019-04-16 16:03             ` Eli Zaretskii
  2019-04-17  2:02           ` Shuguang Sun
       [not found]           ` <vk5ywojt2xu2.fsf@qq.com>
  3 siblings, 1 reply; 21+ messages in thread
From: Noam Postavsky @ 2019-04-16 15:20 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Shuguang Sun, 35241

On Tue, 16 Apr 2019 at 08:50, Michael Albinus <michael.albinus@gmx.de> wrote:

> How does come "." into exec-path? Have you set this in your .emacs? Or
> is it part of the PATH environment variable on your system? You know,
> that it is discouraged to add "." to your PATH for security reasons.

It seems if PATH ends with a trailing ";" then exec-path gets a ".", I
just noticed this is the case for my Windows machine. The Windows
shell acts as if "." is part of PATH regardless, as far as I can tell.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 15:20           ` Noam Postavsky
@ 2019-04-16 16:03             ` Eli Zaretskii
  2019-04-16 16:12               ` Michael Albinus
  0 siblings, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2019-04-16 16:03 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: shuguang79, 35241, michael.albinus

> From: Noam Postavsky <npostavs@gmail.com>
> Date: Tue, 16 Apr 2019 11:20:17 -0400
> Cc: Shuguang Sun <shuguang79@qq.com>, 35241@debbugs.gnu.org
> 
> The Windows shell acts as if "." is part of PATH regardless, as far
> as I can tell.

It isn't the shell, it's how executable search works on the OS level.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 16:03             ` Eli Zaretskii
@ 2019-04-16 16:12               ` Michael Albinus
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-16 16:12 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shuguang79, 35241, Noam Postavsky

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Noam Postavsky <npostavs@gmail.com>
>> Date: Tue, 16 Apr 2019 11:20:17 -0400
>> Cc: Shuguang Sun <shuguang79@qq.com>, 35241@debbugs.gnu.org
>>
>> The Windows shell acts as if "." is part of PATH regardless, as far
>> as I can tell.
>
> It isn't the shell, it's how executable search works on the OS level.

The docstring of `exec-path' says "Each element is a string (directory
name) or nil (try default directory)." This is implemented in
decode_env_path. Hmm.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 14:47           ` Eli Zaretskii
@ 2019-04-16 16:20             ` Michael Albinus
  2019-04-16 16:42               ` Eli Zaretskii
  2019-04-17  7:35               ` Michael Albinus
  0 siblings, 2 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-16 16:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shuguang79, 35241, npostavs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Michael Albinus <michael.albinus@gmx.de>
>> Date: Tue, 16 Apr 2019 14:50:40 +0200
>> Cc: 35241@debbugs.gnu.org, Noam Postavsky <npostavs@gmail.com>
>>
>> Relative file names are not forbidden as part of exec-path. Shall we ban
>> them (with an error message)? Or shall we ignore them, silently? Don't know.
>>
>> I'd vote for the latter (including proper documentation).
>
> Maybe executable-find should ignore them if default-directory is
> remote?

Or suppress file name handlers if the REMOTE arg is nil? Like

--8<---------------cut here---------------start------------->8---
*** /tmp/ediffaHi4iI	2019-04-16 18:15:36.467002896 +0200
--- /home/albinus/src/emacs/lisp/files.el	2019-04-16 18:15:25.698810831 +0200
***************
*** 1058,1064 ****
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (locate-file command exec-path exec-suffixes 1)))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.
--- 1058,1065 ----
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (let (file-name-handler)
!       (locate-file command exec-path exec-suffixes 1))))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.
--8<---------------cut here---------------end--------------->8---

Alternatively, we could just suppress Tramp:

--8<---------------cut here---------------start------------->8---
*** /tmp/ediffaHi4iI	2019-04-16 18:15:36.467002896 +0200
--- /home/albinus/src/emacs/lisp/files.el	2019-04-16 18:15:25.698810831 +0200
***************
*** 1058,1064 ****
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (locate-file command exec-path exec-suffixes 1)))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.
--- 1058,1065 ----
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (let (tramp-mode)
!       (locate-file command exec-path exec-suffixes 1))))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.
--8<---------------cut here---------------end--------------->8---

But in this case, other remote default directories would do the same
harm. Think about `url-handler-mode', for example.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 16:20             ` Michael Albinus
@ 2019-04-16 16:42               ` Eli Zaretskii
  2019-04-16 19:42                 ` Michael Albinus
  2019-04-17  7:35               ` Michael Albinus
  1 sibling, 1 reply; 21+ messages in thread
From: Eli Zaretskii @ 2019-04-16 16:42 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, 35241, npostavs

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: shuguang79@qq.com,  35241@debbugs.gnu.org,  npostavs@gmail.com
> Date: Tue, 16 Apr 2019 18:20:24 +0200
> 
> But in this case, other remote default directories would do the same
> harm. Think about `url-handler-mode', for example.

I don't think I understand the situation you had in mind.  Can you
elaborate?





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 16:42               ` Eli Zaretskii
@ 2019-04-16 19:42                 ` Michael Albinus
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-16 19:42 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shuguang79, 35241, npostavs

Eli Zaretskii <eliz@gnu.org> writes:

>> But in this case, other remote default directories would do the same
>> harm. Think about `url-handler-mode', for example.
>
> I don't think I understand the situation you had in mind.  Can you
> elaborate?

(url-handler-mode 1)
(let ((default-directory "ftp://ftp.gnu.org/")
      (exec-path (cons "." exec-path)))
  (executable-find "ls"))





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 12:50         ` Michael Albinus
  2019-04-16 14:47           ` Eli Zaretskii
  2019-04-16 15:20           ` Noam Postavsky
@ 2019-04-17  2:02           ` Shuguang Sun
       [not found]           ` <vk5ywojt2xu2.fsf@qq.com>
  3 siblings, 0 replies; 21+ messages in thread
From: Shuguang Sun @ 2019-04-17  2:02 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 35241, Noam Postavsky

Michael Albinus <michael.albinus@gmx.de> writes:

> Shuguang Sun <shuguang79@qq.com> writes:
>
> Hi,
>
>>>>   tramp-file-name-handler(expand-file-name "." "/plink:username@host.com:")
>>>>   locate-file-internal("gpg2" (list of path) (".exe" ".com" ".bat"
>>>> ".cmd" ".btm" "") 1)
>>>>   executable-find("gpg2")
>>>
>>> This is the crucial part. `executable-find' shall operate on the local
>>> file system only. But it calls `locate-file-internal' with a PATH
>>> pointing to remote.
>>>
>>> I suppose you have edited the backtrace, and written (list of path).
>>> What is there? My crystal ball tells me it contains "." ...
>>
>> Sorry. I do modified it here. It is the local path, not remote. And it
>> contains "." which looks like:
>>
>>   locate-file("gpg2" ("." "C:/Users/username/emacs/bin/"
>> "C:/Users/username/scoop/apps/gnupg/current/bin/"
>> "C:/Users/username/scoop/shims/" "C:/Users/username/Progs/msys64/mingw64/bin/"
>> "C:/Users/username/Progs/msys64/usr/bin/"
>> "C:/Users/username/Progs/miktex-portable/texmfs/insta..."
>> "C:/Users/username/AppData/Local/Microsoft/WindowsApp...") (".exe" ".com"
>> ".bat" ".cmd" ".btm" "") 1)
>
> Thanks, as I've expected. A relative file name like "." is the
> problem. If the current directory is a remote one, it expands to a
> remote directory inside exec-path, with all the hassle.
>
> How does come "." into exec-path? Have you set this in your .emacs? Or
> is it part of the PATH environment variable on your system? You know,
> that it is discouraged to add "." to your PATH for security reasons.

I added it in my configure file years ago and can't remember the reasons.
I remove this part (add "." to exec-path) from my configure, and then it works well.
Tramp can open gpg.

>
> Relative file names are not forbidden as part of exec-path. Shall we ban
> them (with an error message)? Or shall we ignore them, silently? Don't know.
>
> I'd vote for the latter (including proper documentation).
>
> Best regards, Michael.
>
>
>
>

-- 
Best Regards
Shuguang Sun








^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
       [not found]           ` <vk5ywojt2xu2.fsf@qq.com>
@ 2019-04-17  7:24             ` Michael Albinus
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-17  7:24 UTC (permalink / raw)
  To: Shuguang Sun; +Cc: 35241, Noam Postavsky

Shuguang Sun <shuguang79@qq.com> writes:

Hi,

>> How does come "." into exec-path? Have you set this in your .emacs? Or
>> is it part of the PATH environment variable on your system? You know,
>> that it is discouraged to add "." to your PATH for security reasons.
>
> I added it in my configure file years ago and can't remember the reasons.
> I remove this part (add "." to exec-path) from my configure, and then
> it works well.
> Tramp can open gpg.

Good, that is fixed for you. However, I will use this bug report for
fixing it in general.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-16 16:20             ` Michael Albinus
  2019-04-16 16:42               ` Eli Zaretskii
@ 2019-04-17  7:35               ` Michael Albinus
  2019-04-17 12:08                 ` Michael Albinus
  1 sibling, 1 reply; 21+ messages in thread
From: Michael Albinus @ 2019-04-17  7:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shuguang79, 35241, npostavs

[-- Attachment #1: Type: text/plain, Size: 506 bytes --]

Michael Albinus <michael.albinus@gmx.de> writes:

>>> Relative file names are not forbidden as part of exec-path. Shall we ban
>>> them (with an error message)? Or shall we ignore them, silently? Don't know.
>>>
>>> I'd vote for the latter (including proper documentation).
>>
>> Maybe executable-find should ignore them if default-directory is
>> remote?
>
> Or suppress file name handlers if the REMOTE arg is nil?

Thinking about, the appropriate solution is quoting `default-directory':


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 868 bytes --]

*** /tmp/ediffPBChhu	2019-04-17 09:28:24.986244205 +0200
--- /home/albinus/src/emacs/lisp/files.el	2019-04-16 21:48:35.560684261 +0200
***************
*** 1058,1064 ****
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (locate-file command exec-path exec-suffixes 1)))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.
--- 1058,1065 ----
          (when (stringp res) (file-local-name res)))
      ;; Use 1 rather than file-executable-p to better match the
      ;; behavior of call-process.
!     (let ((default-directory (file-name-quote default-directory 'top)))
!       (locate-file command exec-path exec-suffixes 1))))

  (defun load-library (library)
    "Load the Emacs Lisp library named LIBRARY.

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]


This does not work yet, `locate-file-internal' does not cooperate with a
quoted `default-directory'. Will debug.

Best regards, Michael.

^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-17  7:35               ` Michael Albinus
@ 2019-04-17 12:08                 ` Michael Albinus
  2019-04-17 14:29                   ` Noam Postavsky
  2019-04-17 17:07                   ` Eli Zaretskii
  0 siblings, 2 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-17 12:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: shuguang79, 35241-done, npostavs

Michael Albinus <michael.albinus@gmx.de> writes:

> Thinking about, the appropriate solution is quoting `default-directory':
>
> This does not work yet, `locate-file-internal' does not cooperate with a
> quoted `default-directory'. Will debug.

It was a problem with my local environment, not relevant for the problem.

I've pushed the fix and a respective test case to master. Closing the bug.

It would be great, if somebody could confirm that
`files-tests-executable-find' passes on MS Windows. I cannot test myself.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-17 12:08                 ` Michael Albinus
@ 2019-04-17 14:29                   ` Noam Postavsky
  2019-04-17 19:09                     ` Michael Albinus
  2019-04-17 17:07                   ` Eli Zaretskii
  1 sibling, 1 reply; 21+ messages in thread
From: Noam Postavsky @ 2019-04-17 14:29 UTC (permalink / raw)
  To: Michael Albinus; +Cc: Shuguang Sun, 35241

On Wed, 17 Apr 2019 at 08:08, Michael Albinus <michael.albinus@gmx.de> wrote:

> I've pushed the fix and a respective test case to master. Closing the bug.
>
> It would be great, if somebody could confirm that
> `files-tests-executable-find' passes on MS Windows. I cannot test myself.

It needed a small change: a file needs to end with .exe or similar to
be considered executable on Windows. I pushed a fix.

[1: 63a190a]: 2019-04-17 10:27:02 -0400
  ; Fix files-tests-executable-find on w32 (Bug#35241)
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=63a190a640f620f49b42e70e9e68f88e61c158b3





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-17 12:08                 ` Michael Albinus
  2019-04-17 14:29                   ` Noam Postavsky
@ 2019-04-17 17:07                   ` Eli Zaretskii
  1 sibling, 0 replies; 21+ messages in thread
From: Eli Zaretskii @ 2019-04-17 17:07 UTC (permalink / raw)
  To: Michael Albinus; +Cc: shuguang79, 35241-done, npostavs

> From: Michael Albinus <michael.albinus@gmx.de>
> Cc: shuguang79@qq.com,  35241-done@debbugs.gnu.org,  npostavs@gmail.com
> Date: Wed, 17 Apr 2019 14:08:19 +0200
> 
> It would be great, if somebody could confirm that
> `files-tests-executable-find' passes on MS Windows. I cannot test myself.

It passes here (after Noam's fixes).

Thanks.





^ permalink raw reply	[flat|nested] 21+ messages in thread

* bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
  2019-04-17 14:29                   ` Noam Postavsky
@ 2019-04-17 19:09                     ` Michael Albinus
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Albinus @ 2019-04-17 19:09 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: Shuguang Sun, 35241

Noam Postavsky <npostavs@gmail.com> writes:

Hi Noam,

> It needed a small change: a file needs to end with .exe or similar to
> be considered executable on Windows. I pushed a fix.

Thanks!

Best regards, Michael.





^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-04-17 19:09 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-12  2:44 bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10 Shuguang Sun
     [not found] <vk5yimvkeyca.fsf@qq.com>
2019-04-16  1:20 ` Noam Postavsky
2019-04-16  4:54   ` Shuguang Sun
2019-04-16  7:18     ` Michael Albinus
2019-04-16  9:34       ` Shuguang Sun
2019-04-16  9:42       ` Shuguang Sun
     [not found]       ` <vk5y5zrei997.fsf@qq.com>
2019-04-16 12:50         ` Michael Albinus
2019-04-16 14:47           ` Eli Zaretskii
2019-04-16 16:20             ` Michael Albinus
2019-04-16 16:42               ` Eli Zaretskii
2019-04-16 19:42                 ` Michael Albinus
2019-04-17  7:35               ` Michael Albinus
2019-04-17 12:08                 ` Michael Albinus
2019-04-17 14:29                   ` Noam Postavsky
2019-04-17 19:09                     ` Michael Albinus
2019-04-17 17:07                   ` Eli Zaretskii
2019-04-16 15:20           ` Noam Postavsky
2019-04-16 16:03             ` Eli Zaretskii
2019-04-16 16:12               ` Michael Albinus
2019-04-17  2:02           ` Shuguang Sun
     [not found]           ` <vk5ywojt2xu2.fsf@qq.com>
2019-04-17  7:24             ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).