bug#20008: 24.4; Eshell eshell/which uses eshell-path-env but error with (getenv "PATH"), and these 2 sometimes get out of sync (not remote directory)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#20008: 24.4; Eshell eshell/which uses eshell-path-env but error with (getenv "PATH"), and these 2 sometimes get out of sync (not remote directory)

Hua Wei

M-x eshell
switch to other buffer
use (setenv "PATH"  "some path") to set new PATH env var
enter eshell with C-u 2 eshell   (there is already one eshell buffer running)
  a new eshell buffer opens
type command "which <new cmd under new path>"
output   "not found   in 'path'"  (in this message, the 'path' is from (getenv "PATH"))
  this is confusing, because the function uses 'eshell-path-env' for search and use (getenv "PATH") for error messaging
the bug:
eshell-path-env gets out of sync with (getenv "PATH")




In GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.7)
 of 2014-11-29
Windowing system distributor `The X.Org Foundation', version 11.0.11403000
System Description: Linux Mint 16 Petra

Important settings:
  value of $LC_MONETARY: ja_JP.UTF-8
  value of $LC_NUMERIC: ja_JP.UTF-8
  value of $LC_TIME: ja_JP.UTF-8
  value of $LANG: zh_CN.utf8
  value of $XMODIFIERS: @im=none
  locale-coding-system: utf-8-unix

Major mode: EShell

Minor modes in effect:
  semantic-minor-modes-format: ((:eval (if (or semantic-highlight-edits-mode semantic-show-unmatched-syntax-mode semantic-idle-scheduler-mode)  S)))
  shell-dirtrack-mode: t
  display-time-mode: t
  evil-mode: t
  evil-local-mode: t
  ido-ubiquitous-mode: t
  on-screen-global-mode: t
  electric-pair-mode: t
  global-ede-mode: t
  global-cwarn-mode: t
  global-semantic-idle-breadcrumbs-mode: t
  show-paren-mode: t
  global-highlight-changes-mode: t
  highlight-changes-visible-mode: t
  global-hl-line-mode: t
  icomplete-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  ido-everywhere: t
  winner-mode: t
  global-undo-tree-mode: t
  undo-tree-mode: t
  recentf-mode: t
  override-global-mode: t
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-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
  column-number-mode: t
  line-number-mode: t
  global-visual-line-mode: t
  visual-line-mode: t
  transient-mark-mode: t
  abbrev-mode: t


Recent messages:
Invalid face reference: nil [13 times]

Invalid face reference: nil [13 times]
 [2 times]
Invalid face reference: nil [13 times]
QuitInvalid face reference: nil
Invalid face reference: nil [12 times]
Quit
Invalid face reference: nil [39 times]
 [2 times]

Load-path shadows:
/usr/share/emacs/site-lisp/flim/hex-util hides /usr/local/share/emacs/24.4/lisp/hex-util
/usr/share/emacs/site-lisp/flim/md4 hides /usr/local/share/emacs/24.4/lisp/md4
/usr/share/emacs/site-lisp/flim/sasl-ntlm hides /usr/local/share/emacs/24.4/lisp/net/sasl-ntlm
/usr/share/emacs/site-lisp/flim/hmac-md5 hides /usr/local/share/emacs/24.4/lisp/net/hmac-md5
/usr/share/emacs/site-lisp/flim/sasl hides /usr/local/share/emacs/24.4/lisp/net/sasl
/usr/share/emacs/site-lisp/flim/sasl-digest hides /usr/local/share/emacs/24.4/lisp/net/sasl-digest
/usr/share/emacs/site-lisp/flim/hmac-def hides /usr/local/share/emacs/24.4/lisp/net/hmac-def
/usr/share/emacs/site-lisp/flim/sasl-cram hides /usr/local/share/emacs/24.4/lisp/net/sasl-cram
/usr/share/emacs/site-lisp/flim/ntlm hides /usr/local/share/emacs/24.4/lisp/net/ntlm
/usr/share/emacs/site-lisp/flim/attic/smtpmail hides /usr/local/share/emacs/24.4/lisp/mail/smtpmail
/usr/share/emacs/site-lisp/wl/utils/rfc2368 hides /usr/local/share/emacs/24.4/lisp/mail/rfc2368
/usr/share/emacs/site-lisp/wl/elmo/utf7 hides /usr/local/share/emacs/24.4/lisp/gnus/utf7

Features:
(shadow emacsbug message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
pcmpl-unix conf-mode debug hi-lock man tramp-sh gnutls network-stream
starttls tls sh-script smie executable image-file ffap url-parse
url-vars org-capture ede/linux ede/make tramp-cache tramp-smb tramp
tramp-compat auth-source password-cache tramp-loaddefs trampver
ede/emacs bookmark dired-aux sort org-clock misearch multi-isearch
ledger-mode ledger-schedule ledger-xact ledger-texi ledger-test
ledger-state ledger-sort ledger-report ledger-reconcile ledger-post
ledger-occur ledger-init ledger-fonts ledger-exec ledger-context
ledger-complete ledger-commodities ledger-regex rx shell cal-move
parse-time w3m-form mel-q-ccl pccl pccl-20 elmo-internal offlineimap
modb-legacy modb-standard elmo-maildir mime-setup mail-mime-setup
semi-setup mime-image mime-w3m w3m w3m-hist w3m-fb bookmark-w3m
w3m-ems w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util elmo-nntp
wl-spam elmo-spam elsp-header elsp-generic wl-fldmgr wl-score smtp
sasl sasl-anonymous sasl-login sasl-plain wl-demo wl-news wl-address
pldap wl-thread wl-action wl wl-e21 wl-draft wl-template wl-summary
ps-print ps-def lpr wl-refile wl-message wl-mime pgg pgg-parse pgg-def
epa derived epg mime-play filename mime-edit eword-encode sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils elmo-mime
mmelmo-buffer mmelmo-imap mime-view flow-fill mime-conf calist
semi-def mmimap mime-parse mmbuffer wl-highlight elmo-filter
elmo-multi wl-folder wl-util crm time-stamp elmo-pop3 elmo-net
elmo-cache elmo-map elmo-dop elmo-flag elmo-localdir wl-vars
wl-version elmo elmo-signal elmo-msgdb modb modb-generic modb-entity
mime mmgeneric elmo-util emu invisible inv-23 poem poem-e20 poem-e20_3
eword-decode mel mime-def alist std11 mcharset mcs-20 mcs-e20 pces
pces-e20 pces-20 broken pcustom elmo-date timezone elmo-vars path-util
poe elmo-version pym static apel-ver product luna cl cal-julian
cal-china lunar solar cal-dst cal-bahai cal-islam cal-hebrew holidays
hol-loaddefs cal-iso imenu org-element org-rmail org-mhe org-irc
org-info org-gnus gnus-util org-docview doc-view jka-compr image-mode
org-bibtex bibtex org-bbdb org-w3m org-agenda org org-macro
org-footnote org-pcomplete org-list org-faces org-entities noutline
outline org-version ob-emacs-lisp ob ob-tangle ob-ref ob-lob ob-table
ob-exp org-src ob-keys ob-comint ob-core ob-eval org-compat org-macs
org-loaddefs format-spec find-lisp tabify eieio-opt find-func vc-git
em-unix em-term term disp-table ehelp em-script em-prompt em-ls
em-hist em-pred em-glob em-dirs em-cmpl em-basic em-banner em-alias
pcomplete esh-var esh-io esh-cmd esh-opt esh-ext esh-proc esh-arg
eldoc esh-groups eshell esh-module esh-mode esh-util mule-util pp
thingatpt semantic/ia semantic/analyze/refs semantic/db-find
semantic/db-ref semantic/senator semantic/decorate pulse
semantic/analyze semantic/scope semantic/analyze/fcn semantic/db
cc-langs ede/cpp-root ede/dired dired-x dired flymake compile comint
ansi-color server time evil evil-integration evil-maps evil-commands
evil-types evil-digraphs evil-search evil-ex evil-macros evil-repeat
evil-states evil-core evil-common rect evil-vars filesets
ido-ubiquitous warnings help-mode eim on-screen elec-pair ede/speedbar
ede/files ede ede/base ede/auto ede/source eieio-base eieio-speedbar
eieio-custom cwarn cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs semantic/idle
semantic/ctxt semantic/sb speedbar sb-image dframe semantic/sort
semantic/format ezimage semantic/tag-ls semantic/find
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw eieio eieio-core mode-local cedet webjump browse-url paren
appt diary-lib diary-loaddefs cal-menu calendar cal-loaddefs hilit-chg
hl-line icomplete ls-lisp auto-complete-config auto-complete cl-macs
gv popup ido linum buffer-stack winner ring windmove edmacro kmacro
undo-tree diff byte-opt advice help-fns saveplace recentf tree-widget
wid-edit cl-loaddefs cl-lib use-package diminish bytecomp byte-compile
cconv bind-key easy-mmode buffer-stack-autoloads csharp-mode-autoloads
dic-lookup-w3m-autoloads dictionary-autoloads connection-autoloads
dired+-autoloads eimp-autoloads emms-mark-ext-autoloads emms-autoloads
evil-autoloads google-autoloads goto-last-change-autoloads
highlight-symbol-autoloads imenu-anywhere-autoloads
ledger-mode-autoloads link-autoloads offlineimap-autoloads
on-screen-autoloads org-gnome-autoloads gnome-calendar-autoloads
notify-autoloads powershell-autoloads powershell-mode-autoloads
s-autoloads stem-autoloads telepathy-autoloads theme-changer-autoloads
tracking-autoloads shorten-autoloads undo-tree-autoloads info easymenu
w3m-autoloads wcheck-mode-autoloads zenburn-theme-autoloads package
epg-config time-date china-util tooltip electric uniquify ediff-hook
vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode
register page menu-bar rfn-eshadow timer select scroll-bar mouse
jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
dbusbind gfilenotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs)

Memory information:
((conses 16 2559778 253066)
 (symbols 48 59811 32)
 (miscs 40 29056 24205)
 (strings 32 749716 22463)
 (string-bytes 1 8742906)
 (vectors 16 53911)
 (vector-slots 8 1300845 159353)
 (floats 8 1432 2608)
 (intervals 56 50066 821)
 (buffers 960 276)
 (heap 1024 159776 4041))




Reply | Threaded
Open this post in threaded view
|

bug#20008: 24.4; Eshell eshell/which uses eshell-path-env but error with (getenv "PATH"), and these 2 sometimes get out of sync (not remote directory)

Stefan Kangas
found 20008 27.0.50
tags 20008 + confirmed
thanks

Hua Wei <[hidden email]> writes:

> M-x eshell
> switch to other buffer
> use (setenv "PATH"  "some path") to set new PATH env var
> enter eshell with C-u 2 eshell   (there is already one eshell buffer running)
>   a new eshell buffer opens
> type command "which <new cmd under new path>"
> output   "not found   in 'path'"  (in this message, the 'path' is from (getenv "PATH"))
>   this is confusing, because the function uses 'eshell-path-env' for search and use (getenv "PATH") for error messaging
> the bug:
> eshell-path-env gets out of sync with (getenv "PATH")

I can reproduce this bug on Emacs 27.1 using the following recipe:

0. emacs -Q
1. M-x eshell
2. Enter commands in eshell:

   mkdir /tmp/foobin
   cp /bin/true /tmp/foobin/foobar
   setenv PATH /tmp/foobin
   foobar

Here is a transcript:

    Welcome to the Emacs shell
   
    ~ $ mkdir /tmp/foobin
    ~ $ cp /bin/true /tmp/foobin/foobar
    ~ $ setenv PATH /tmp/foobin
    /tmp/foobin
    ~ $ foobar
    foobar: command not found

Best regards,
Stefan Kangas