Closed wyuenho closed 4 years ago
exec-path-from-shell
is not doing anything exotic, just setting exec-path
.
When running, exec-path-from-shell
does call functions in other libraries which would cause them to get loaded, e.g. file-remote-p
potentially causes parts of tramp or the GPG-handling libraries to be loaded. Now, if those libraries are configuring themselves at load-time based on whether they find certain executables on the exec-path
, then they might come to the wrong conclusions. So the sequence might be:
exec-path-from-shell.el
starts loadingssh
, gpg
, the shell)exec-path-from-shell.el
changes exec-path
If that's the case, it's an Emacs bug, or at least not really an exec-path-from-shell
bug. But you might also consider enabling exec-path-from-shell-debug
to see what exec-path-from-shell
is doing.
Yeah I thought it's probably not exec-path-from-shell
. I've tried turning on exec-path-from-shell--debug
, but there's nothing interesting. Sadly, I can't edebug-defun
file-remote-p
, as redisplay_internal
appears to keep calling it so I can't progress once I'm in there.
I've filed bug 39389 to emacs, would appreciate you replying if you have the time.
Ok this is entirely Emac's problem. Closing this.
Ah, good work tracking that down.
So these 2 bugs I describe are a bit weird, I've reported this to the emacs devs but they've suggested me to report it here, so please bear with me:
Bug 1
$ echo 'PATH=".:$PATH"' > .bash_profile
$ echo '(require 'exec-path-from-shell)(exec-path-from-shell-initialize)' > .emacs
Launch
/Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs
in GUIC-x C-f /sudo:: RET
Cursor now stops blinking but no password prompt is shown.
If you TAB complete after /sudo: but before the final :, prompt will not be stuck
This bug can only be reproduced if steps 1-3 are followed exactly. The following examples can't reproduce this problem:
$ /Application/MacPorts/Emacs.app/Contents/MacOS/Emacs -Q -l tramp -l /path/to/exec-path-from-shell --eval '(exec-path-from-shell-initialize)' /sudo::
$ echo '(set exec-path (cons "." exec-path))' > .emacs; /Applications/MacPorts/Emacs.app/Contents/MacOS/Emacs
There's some very weird interactions with how Emacs starts up, what happens to Emacs after
call-process
on SHELL and settingexec-path
, and tab completion of /sudo:: in the minibuffer. This appears to have been the case since relatively early versions of Emacs 27.Workaround
If
auth-sources
is set to'("~/.authinfo.gpg")
and~/.authinfo.gpg
has saved the credentials of localhost or the machine's host name, bug 2 does not happened.Bug 2
Same as Bug 1
$ echo '(require 'exec-path-from-shell)(exec-path-from-shell-initialize)(require 'crux)' > .emacs
Same as Bug 1
Same as Bug 1
M-x crux-sudo-edit
Minibuffer now stuck at "Tramp: Sending Password"
Same workaround works for this bug.
I was wondering if you have any idea what's going on with emacs-27's
call-process
, as in why exec'ing the shell before and after changes emac's behavior?