GNU bug report logs - #35241
27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10

Previous Next

Package: emacs;

Reported by: Shuguang Sun <shuguang79 <at> qq.com>

Date: Fri, 12 Apr 2019 02:46:01 UTC

Severity: normal

Found in version 27.0.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35241 in the body.
You can then email your comments to 35241 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Fri, 12 Apr 2019 02:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Shuguang Sun <shuguang79 <at> qq.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 12 Apr 2019 02:46:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10 
Date: Fri, 12 Apr 2019 10:44:53 +0800
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







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 01:21:01 GMT) Full text and rfc822 format available.

Message #8 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 35241 <at> debbugs.gnu.org
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Mon, 15 Apr 2019 21:20:37 -0400
Shuguang Sun <shuguang79 <at> 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?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 04:55:02 GMT) Full text and rfc822 format available.

Message #11 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 35241 <at> debbugs.gnu.org
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 12:54:14 +0800
Noam Postavsky <npostavs <at> gmail.com> writes:

> Shuguang Sun <shuguang79 <at> 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 <at> host.com*>)
  tramp-wait-for-regexp(#<process *tramp/plink username <at> host.com*> nil "\\(^\\|\0\\)[^#$\n]*///92fc211a5...")
  tramp-wait-for-output(#<process *tramp/plink username <at> 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 <at> host.com:")
  apply(tramp-sh-handle-expand-file-name ("." "/plink:username <at> host.com:"))
  tramp-sh-file-name-handler(expand-file-name "." "/plink:username <at> host.com:")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/plink:username <at> host.com:"))
  tramp-file-name-handler(expand-file-name "." "/plink:username <at> 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 <at> host.com*>)
  tramp-action-password(#<process *tramp/plink username <at> host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil))
--8<---------------cut here---------------end--------------->8---


-- 
Best Regards
Shuguang Sun






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 07:20:02 GMT) Full text and rfc822 format available.

Message #14 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 09:18:53 +0200
Shuguang Sun <shuguang79 <at> 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 <at> 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.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 09:35:02 GMT) Full text and rfc822 format available.

Message #17 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 17:34:28 +0800
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Shuguang Sun <shuguang79 <at> 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 <at> 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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 09:43:01 GMT) Full text and rfc822 format available.

Message #20 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 17:42:05 +0800
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Shuguang Sun <shuguang79 <at> 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 <at> 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 <at> host.com*>)
  tramp-wait-for-regexp(#<process *tramp/plink username <at> host.com*> nil "\\(^\\|\0\\)[^#$\n]*///61c1f45b2851d8909126eda541bf6308...")
  tramp-wait-for-output(#<process *tramp/plink username <at> 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 <at> host.com:")
  apply(tramp-sh-handle-expand-file-name ("." "/plink:username <at> host.com:"))
  tramp-sh-file-name-handler(expand-file-name "." "/plink:username <at> host.com:")
  apply(tramp-sh-file-name-handler expand-file-name ("." "/plink:username <at> host.com:"))
  tramp-file-name-handler(expand-file-name "." "/plink:username <at> 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 <at> host.com*>)
  tramp-action-password(#<process *tramp/plink username <at> host.com*> (tramp-file-name "plink" "username" nil "host.com" nil "/home/username/" nil))
  tramp-process-one-action(#<process *tramp/plink username <at> 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 <at> 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 <at> host.com:/home/username/" string)
  apply(tramp-sh-handle-file-attributes ("/plink:username <at> host.com:/home/username/" string))
  tramp-sh-file-name-handler(file-attributes "/plink:username <at> host.com:/home/username/" string)
  apply(tramp-sh-file-name-handler file-attributes ("/plink:username <at> host.com:/home/username/" string))
  tramp-file-name-handler(file-attributes "/plink:username <at> host.com:/home/username/" string)
  file-attributes("/plink:username <at> 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 <at> host.com:/home/username/")
  apply(tramp-sh-handle-file-readable-p "/plink:username <at> host.com:/home/username/")
  tramp-sh-file-name-handler(file-readable-p "/plink:username <at> host.com:/home/username/")
  apply(tramp-sh-file-name-handler file-readable-p "/plink:username <at> host.com:/home/username/")
  tramp-file-name-handler(file-readable-p "/plink:username <at> host.com:/home/username/")
  file-readable-p("/plink:username <at> host.com:/home/username/")
--8<---------------cut here---------------end--------------->8---




-- 
Best Regards
Shuguang Sun






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 12:51:02 GMT) Full text and rfc822 format available.

Message #23 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 14:50:40 +0200
Shuguang Sun <shuguang79 <at> qq.com> writes:

Hi,

>>>   tramp-file-name-handler(expand-file-name "." "/plink:username <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 14:48:02 GMT) Full text and rfc822 format available.

Message #26 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 17:47:42 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Tue, 16 Apr 2019 14:50:40 +0200
> Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 15:21:03 GMT) Full text and rfc822 format available.

Message #29 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, Shuguang Sun <shuguang79 <at> qq.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 11:20:17 -0400
On Tue, 16 Apr 2019 at 08:50, Michael Albinus <michael.albinus <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 16:04:02 GMT) Full text and rfc822 format available.

Message #32 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, michael.albinus <at> gmx.de
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 19:03:11 +0300
> From: Noam Postavsky <npostavs <at> gmail.com>
> Date: Tue, 16 Apr 2019 11:20:17 -0400
> Cc: Shuguang Sun <shuguang79 <at> qq.com>, 35241 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 16:14:02 GMT) Full text and rfc822 format available.

Message #35 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com,
 Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 18:12:53 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Noam Postavsky <npostavs <at> gmail.com>
>> Date: Tue, 16 Apr 2019 11:20:17 -0400
>> Cc: Shuguang Sun <shuguang79 <at> qq.com>, 35241 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 16:21:01 GMT) Full text and rfc822 format available.

Message #38 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 18:20:24 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Michael Albinus <michael.albinus <at> gmx.de>
>> Date: Tue, 16 Apr 2019 14:50:40 +0200
>> Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 16:44:01 GMT) Full text and rfc822 format available.

Message #41 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 19:42:49 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: shuguang79 <at> qq.com,  35241 <at> debbugs.gnu.org,  npostavs <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Tue, 16 Apr 2019 19:43:02 GMT) Full text and rfc822 format available.

Message #44 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Tue, 16 Apr 2019 21:42:06 +0200
Eli Zaretskii <eliz <at> 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"))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 02:03:01 GMT) Full text and rfc822 format available.

Message #47 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Shuguang Sun <shuguang79 <at> qq.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 10:02:29 +0800
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Shuguang Sun <shuguang79 <at> qq.com> writes:
>
> Hi,
>
>>>>   tramp-file-name-handler(expand-file-name "." "/plink:username <at> 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







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 07:25:02 GMT) Full text and rfc822 format available.

Message #50 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Shuguang Sun <shuguang79 <at> qq.com>
Cc: 35241 <at> debbugs.gnu.org, Noam Postavsky <npostavs <at> gmail.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 09:24:44 +0200
Shuguang Sun <shuguang79 <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 07:36:01 GMT) Full text and rfc822 format available.

Message #53 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35241 <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 09:35:12 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> 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':

[Message part 2 (text/x-patch, inline)]
*** /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.
[Message part 3 (text/plain, inline)]
This does not work yet, `locate-file-internal' does not cooperate with a
quoted `default-directory'. Will debug.

Best regards, Michael.

Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Wed, 17 Apr 2019 12:09:01 GMT) Full text and rfc822 format available.

Notification sent to Shuguang Sun <shuguang79 <at> qq.com>:
bug acknowledged by developer. (Wed, 17 Apr 2019 12:09:02 GMT) Full text and rfc822 format available.

Message #58 received at 35241-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 35241-done <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 14:08:19 +0200
Michael Albinus <michael.albinus <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 14:30:02 GMT) Full text and rfc822 format available.

Message #61 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Shuguang Sun <shuguang79 <at> qq.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 10:29:11 -0400
On Wed, 17 Apr 2019 at 08:08, Michael Albinus <michael.albinus <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 17:08:01 GMT) Full text and rfc822 format available.

Message #64 received at 35241-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 35241-done <at> debbugs.gnu.org, shuguang79 <at> qq.com, npostavs <at> gmail.com
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 20:07:22 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Cc: shuguang79 <at> qq.com,  35241-done <at> debbugs.gnu.org,  npostavs <at> 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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#35241; Package emacs. (Wed, 17 Apr 2019 19:10:02 GMT) Full text and rfc822 format available.

Message #67 received at 35241 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Noam Postavsky <npostavs <at> gmail.com>
Cc: 35241 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Shuguang Sun <shuguang79 <at> qq.com>
Subject: Re: bug#35241: 27.0.50; Tramp can't decrypt .authinfo.gpg in Win 10
Date: Wed, 17 Apr 2019 21:09:25 +0200
Noam Postavsky <npostavs <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 May 2019 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 351 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.