Subject: bug#57370: 28.1; eshell/addpath does not work when called noninteractively

From: Colton Lewis <[email-masked]>
Date: Tue, 23 Aug 2022 20:36:45 +0000

Discovered this trying to add a path from my init file and I just could
not make it work.

1. Create an executable script ~/test-bin/test.sh
2. emacs -Q
3. Eval the elisp snippet `(require 'eshell) (eshell/addpath "~/test-bin")`
4. Start eshell
5. test.sh
6. Observe command not found error

Substituting `(eshell/addpath (file-truename "~/test-bin"))` gives the same
problem.

This should have the same effect as starting eshell immediately and
executing `addpath ~/test-bin`, which has the expected result.

The only workaround I've found is to modify PATH directly with setenv
and getenv.

In GNU Emacs 28.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33,  
cairo version 1.16.0)
  of 2022-06-27, modified by Debian built on kokoro-ubuntu
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Debian GNU/Linux rodete

Configured using:
  'configure --build x86_64-linux-gnu --prefix=/usr
  --sharedstatedir=/var/lib --libexecdir=/usr/lib
  --localstatedir=/var/lib --infodir=/usr/share/info
  --mandir=/usr/share/man --enable-libsystemd --with-pop=yes
   
--enable-locallisppath=/etc/google-emacs:/usr/local/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/site-lisp:/usr/local/share/google-emacs/site-lisp:/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/site-lisp:/usr/share/google-emacs/site-lisp
  --with-sound=alsa --without-gconf --with-mailutils
  --program-prefix=google- --disable-silent-rules
  GOOGLE_VERSION=28.1+gg1+1.20220627.053402.rc213 --build
  x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
  --libexecdir=/usr/lib --localstatedir=/var/lib
  --infodir=/usr/share/info --mandir=/usr/share/man --enable-libsystemd
  --with-pop=yes
   
--enable-locallisppath=/etc/google-emacs:/usr/local/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/site-lisp:/usr/local/share/google-emacs/site-lisp:/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/site-lisp:/usr/share/google-emacs/site-lisp
  --with-sound=alsa --without-gconf --with-mailutils
  --program-prefix=google- --disable-silent-rules
  GOOGLE_VERSION=28.1+gg1+1.20220627.053402.rc213 --with-cairo
  --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
  'CFLAGS=-g -O2
   
-ffile-prefix-map=/build/google-emacs-V4HnnR/google-emacs-28.1+gg1+1.20220627.053402.rc213=.  
-fstack-protector-strong
  -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
  -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
   value of $LANG: en_US.UTF-8
   value of $XMODIFIERS: @im=ibus
   locale-coding-system: utf-8-unix

Major mode: ELisp/l

Minor modes in effect:
   google-tramp-direct-mode: t
   global-subword-mode: t
   subword-mode: t
   google-emacs-support-show-upgrade-mode: t
   editorconfig-mode: t
   google3-build-global-integrate-build-manipulation-mode: t
   google3-build-integrate-build-manipulation-mode: t
   google-kg-mode: t
   shell-dirtrack-mode: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: t

Load-path shadows:
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/f/f-shortdoc  
hides  
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/f/google/f-shortdoc
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/async/smtpmail-async  
hides  
/usr/share/google-emacs/site-lisp/elpa/async-1.9.3/smtpmail-async
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/async/async  
hides  
/usr/share/google-emacs/site-lisp/elpa/async-1.9.3/async
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/async/async-bytecomp  
hides  
/usr/share/google-emacs/site-lisp/elpa/async-1.9.3/async-bytecomp
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/async/dired-async  
hides  
/usr/share/google-emacs/site-lisp/elpa/async-1.9.3/dired-async
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-clang  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-clang
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-tng  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-tng
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-oddmuse  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-oddmuse
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-bbdb  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-bbdb
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-keywords  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-keywords
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-capf  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-capf
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-dabbrev-code  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-dabbrev-code
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-tempo  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-tempo
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-ispell  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-ispell
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-dabbrev  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-dabbrev
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-abbrev  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-abbrev
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-elisp  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-elisp
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-yasnippet  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-yasnippet
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-cmake  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-cmake
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-etags  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-etags
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-template  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-template
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-files  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-files
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-gtags  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-gtags
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-nxml  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-nxml
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-css  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-css
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/company_mode/company-semantic  
hides  
/usr/share/google-emacs/site-lisp/elpa/company-0.9.13/company-semantic
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/dash/dash  
hides  
/usr/share/google-emacs/site-lisp/elpa/dash-2.19.1/dash
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/epl/epl  
hides  
/usr/share/google-emacs/site-lisp/elpa/epl-0.9/epl
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/f/f  
hides /usr/share/google-emacs/site-lisp/elpa/f-0.20.0/f
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/flycheck/flycheck  
hides  
/usr/share/google-emacs/site-lisp/elpa/flycheck-32snapshot/flycheck
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/ht/ht  
hides  
/usr/share/google-emacs/site-lisp/elpa/ht-2.3/ht
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/lv/lv  
hides  
/usr/share/google-emacs/site-lisp/elpa/lv-0.15.0/lv
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/memoize/memoize  
hides  
/usr/share/google-emacs/site-lisp/elpa/memoize-1.1/memoize
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/pkg_info/pkg-info  
hides  
/usr/share/google-emacs/site-lisp/elpa/pkg-info-0.6/pkg-info
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/popup/popup  
hides  
/usr/share/google-emacs/site-lisp/elpa/popup-0.5.8/popup
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/s/s  
hides /usr/share/google-emacs/site-lisp/elpa/s-1.12.0/s
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/spinner/spinner  
hides  
/usr/share/google-emacs/site-lisp/elpa/spinner-1.7.4/spinner
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/yasnippet/yasnippet  
hides  
/usr/share/google-emacs/site-lisp/elpa/yasnippet-0.14.0/yasnippet
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/jsonrpc/jsonrpc  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/jsonrpc
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/transient/lisp/transient  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/transient
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/flymake/flymake  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/progmodes/flymake
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/xref/xref  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/progmodes/xref
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/project/project  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/progmodes/project
/usr/share/google-emacs/site-lisp/elpa/let-alist-1.0.6/let-alist hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/emacs-lisp/let-alist
/usr/share/google-emacs/site-lisp/emacs-google-config/third_party/elisp/eldoc/eldoc  
hides  
/usr/share/google-emacs/28.1+gg1+1.20220627.053402.rc213/lisp/emacs-lisp/eldoc

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader tabify misearch multi-isearch vc-fig
vc-hg diff-mode vc vc-dispatcher editorconfig-core
editorconfig-core-handle editorconfig-fnmatch ido-completing-read+
memoize cus-edit pp cus-start wid-edit minibuf-eldef google-tramp
cap-words superword subword desktop frameset cus-load eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
edmacro kmacro google-pastebin google-prodaccess google-sendgmr sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils google
google-emacs-support editorconfig google-log gud url-sso
google3-build-fn google-imports google3 google-gud google-comint
google-kg google-trailing-whitespace google-coding-style python-custom
sh-script smie python tramp-sh tramp tramp-loaddefs trampver
tramp-integration files-x tramp-compat parse-time iso8601 time-date
ls-lisp js imenu cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine google-codemaker google-process
google-emacs-utilities with-editor cl-extra help-mode server compat
pcase f f-shortdoc shortdoc dash s aio generator
emacs-google-config-loaddefs google-paths xdg rx google-platform sql
view ess-site ess-toolbar ess-mouse mouseme ess-swv ess-noweb
ess-noweb-font-lock-mode ess-jags-d ess-bugs-l essd-els ess-xls-d
ess-vst-d ess-stata-mode ess-stata-lang cc-vars cc-defs make-regexp
ess-sp6w-d ess-sp5-d ess-sp4-d ess-sas-d ess-sas-l ess-sas-a ess-s4-d
ess-s3-d ess-omg-d ess-omg-l ess-arc-d ess-lsp-l ess-sp6-d ess-dde
ess-sp3-d ess-julia julia-mode cl ess-r-mode ess-r-flymake flymake-proc
flymake warnings thingatpt ess-r-xref xref project ess-trns
ess-r-package shell pcomplete ess-r-syntax ess-r-completion ess-roxy
ess-rd essddr noutline outline easy-mmode hideshow ess-s-lang ess-help
info ess-mode ess ess-noweb-mode ess-inf ess-tracebug advice format-spec
ess-generics compile text-property-search ess-utils ido ess-custom
executable comint ansi-color ring package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap url-handlers url-parse auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 221136 15586)
  (symbols 48 24180 1)
  (strings 32 82535 2343)
  (string-bytes 1 2834462)
  (vectors 16 42353)
  (vector-slots 8 861572 72252)
  (floats 8 162 25)
  (intervals 56 617 0)
  (buffers 992 15))