My emacs and shell:
.rc/zshell [master●] » emacs --version ▸▸▸▸▸▹▹▹▹▹ 22:17:29
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.
.rc/zshell [master●] » $SHELL --version ▸▸▸▸▸▹▹▹▹▹ 22:18:26
zsh 5.7.1 (x86_64-apple-darwin18.2.0)
I am using exec-path-from-shell v20191229.112 from MELPA, installed via the Emacs package manager.
I invoke (exec-path-from-shell-initialize)
in my .emacs file, but it always appears to effectively initialize to "sh -c 'printf $PATH'"
.
After looking over the code, it looks like exec-path-from-shell-printf()
invokes:
(call-process "/usr/local/bin/zsh" nil t nil "-i" "-l" "-c" "/usr/bin/printf '__RESULT\\000%s\\000%s\\000__RESULT' \"${PATH-32a4a9eb7fbd9349eb5afaaa063927ce}\" \"${MANPATH-32a4a9eb7fbd9349eb5afaaa063927ce}\"")
__RESULT�/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14�/usr/share/man:/usr/local/share/man:/Library/TeX/Distributions/.DefaultTeX/Contents/Man�__RESULT0
If my actual scripts were invoked, I expect more output and tracing from my zsh init scripts, and a much larger PATH. A small snippet to illustrate below:
% /usr/local/bin/zsh -i -l -c '/usr/bin/printf "PATH %s\n" "$PATH"'
: _zshenv_00_timing 0.004531 -- 0.010184 0.005653
: _zshenv_05_init 0.010355 -- 0.016539 0.006184
...
: _zshrc_85_utilities 0.427664 -- 0.430055 0.002391
: _zshrc_90_nethack 0.430167 -- 0.432548 0.002381
: _zshrc_99_ckupdates 0.432658 -- 0.448017 0.015359
PATH /Users/kvaradhan/bin:/usr/local/bin:/Users/kvaradhan/sbin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/usr/local/Users/kvaradhan/Sync/src/go-libs/bin:/usr/local/Users/kvaradhan/Sync/src/go-libs/sbin:/usr/local/fungible/bin:/usr/local/fungible/sbin:./bin:./sbin:../bin:../sbin
I am puzzled. This:
(call-process "/usr/local/bin/zsh" nil t nil "-i" "-l" "-c" "/bin/ps -fx $$")
UID PID PPID C STIME TTY TIME CMD
0 71582 47588 0 11:35PM ?? 0:00.01 /bin/ps -fx 71582
0
is the final bit that leaves me flumoxxed. How and why is the UID 0 for calls invoked by call-process
? Is that even expected?
Kannan
With questions from @lawlist, removed the .emacs file, so only stock emacs:
(call-process "/bin/sh" nil t nil "-i" "-l" "-c" "/usr/bin/printf '__RESULT\\00\
0%s\\000%s\\000__RESULT' \"${PATH-32a4a9eb7fbd9349eb5afaaa063927ce}\" \"${MANPA\
TH-32a4a9eb7fbd9349eb5afaaa063927ce}\"")
__RESULT/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14:/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_1432a4a9eb7fbd9349eb5afaaa063927ce__RESULT0
(call-process "/usr/local/bin/zsh" nil t nil "-i" "-l" "-c" "/bin/ps -fx $$")
UID PID PPID C STIME TTY TIME CMD
0 72953 72799 0 11:40PM ??
exec-path-from-shell
library and reduce this question to an Emacs -Q situation (no user-configuration)? To do so, try without any user configuration and use the absolute paths to the executables. That way, we can make the question easier to answer and we can ascertain whether this is the default behavior of Emacs.