My emacs and shell:

.rc/zshell [master●] » emacs --version                      ▸▸▸▸▸▹▹▹▹▹ 22:17:29
GNU Emacs 26.3
Copyright (C) 2019 Free Software Foundation, Inc.
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}\"")

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

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?


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\

(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 ??
  • Can we eliminate the 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.
    – lawlist
    Commented Jan 13, 2020 at 6:46
  • I think I did that, when I directly invoke call-process with wired paths (/usr/local/bin/zsh), and one call to printf and one to /bin/ps -ef. I bumped into this problem through exec-path-from-shell, hence my windbaggy explanation, sorry. Should I do something else? Commented Jan 13, 2020 at 7:33
  • 1
    @lawlist I get what you meant. I removed my .emacs, and then invoke `call-process()' directly in the scratch buffer. I have placed the outputs to that above. Same effect though. Commented Jan 13, 2020 at 7:39
  • 2
    "/bin/ps" is setuid root
    – rpluim
    Commented Jan 13, 2020 at 10:15

1 Answer 1


Dumbest possible mistake ever...

I had the following line at the top of each of my shell init files:

test -t 0 || return

This line was to avoid spurious output when running from subshells/remote in strange context. (yeah, I know emacs exchange, but bear with me for a sec... a "!Gfmt" in a vi context would scrogg the file in various ways)

Removing that line fixes emacs, now I have to figure out how to be silent when in a non-terminal context. That issue still remains.

  • Check the value of TERM or run env in both cases to see what differs
    – mmmmmm
    Commented Apr 11, 2020 at 10:26
  • @user151019 Quite simple, really. (call-process "/bin/zsh" nil t nil "-i" "-l" "-c" "tty ; if test -t 0 ; then echo YES ; else echo NO ; fi") not a tty NO Output from a regular interactive shell attaches to a tty, so test -t 0 succeeds. Commented Apr 12, 2020 at 5:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.