GNU bug report logs -
#71655
Eshell external commands do not work under GNU Emacs for Windows
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 7 Jul 2024 20:26:17 -0700
with message-id <ccdaca10-ba36-a6fd-527f-4f8078583898 <at> gmail.com>
and subject line Re: bug#71655: Eshell external commands do not work under GNU Emacs for Windows
has caused the debbugs.gnu.org bug report #71655,
regarding Eshell external commands do not work under GNU Emacs for Windows
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
71655: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71655
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
Hi all,
There appears to be a potential bug with Eshell when running external commands on GNU Emacs for Windows, i.e. not WSL/WSL2/Cygwin.
To reproduce:
Start Emacs with "-Q", open Eshell with `M-x eshell`, run `winget.exe --help`.
(Eshell) $ winget --help
Opening input file: Invalid argument, C:/Users/MyUser/AppData/Local/Microsoft/WindowsApps/winget.exe
For some reason external commands such as `winget.exe` do not appear to be working properly.
I thought that Eshell may be having issues when reading external command arguments, but running `winget.exe` on its own (with no arguments) also returns the same error.
What works:
Running `winget.exe --help` from the inferior shell works.
Running `cmd.exe /c winget.exe --help` from Eshell also works.
Is this a path related issue?
(Eshell) $ which winget.exe
C:/Users/MyUser/AppData/Local/Microsoft/WindowsApps/winget.exe
(Eshell) $ addpath
c:/Windows/system32
C:/Windows
C:/Windows/System32/Wbem
C:/Windows/System32/WindowsPowerShell/v1.0/
C:/Windows/System32/OpenSSH/
C:/Program Files (x86)/Gpg4win/../GnuPG/bin
C:/Program Files/PuTTY/
C:/Users/MyUser/AppData/Local/Microsoft/WindowsApps
.
C:/Users/MyUser/AppData/Local/Programs/oh-my-posh/bin
From the above output, Eshell appears to be aware of the path and therefore should also be able to execute commands such as `winget.exe`.
I tried launching other executables from `C:/Users/MyUser/AppData/Local/Microsoft/WindowsApps/` but they also fail in the exact same way.
Oddly enough, I can execute external commands within Eshell for executables under `c:/Windows/system32/`, e.g. I can execute `ipconfig.exe` from Eshell and it will work just fine. So this bug does not affect all external commands.
(Eshell) $ which ipconfig.exe
c:/Windows/system32/ipconfig.exe
I then tried running Emacs as an administrator (for troubleshooting purposes) but this also gave me the same error when reproducing.
Does anyone know of any Emacs configuration or variables that will fix this issue? I cannot seem to find any information online nor any hints from the docs that would help me solve this problem. There also doesn't appear to be an existing bug on this issue.
Kind regards,
James
Build:
In GNU Emacs 29.3 (build 2, x86_64-w64-mingw32) of 2024-03-24 built on
AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.22631
System Description: Microsoft Windows 10 Pro (v10.0.2009.22631.3737)
Configured using:
'configure --with-modules --without-dbus --with-native-compilation=aot
--without-compress-install --with-sqlite3 --with-tree-sitter
CFLAGS=-O2'
Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB
(NATIVE_COMP present but libgccjit not available)
Important settings:
value of $LANG: ENG
locale-coding-system: cp1252
Major mode: Eshell
Minor modes in effect:
shell-dirtrack-mode: t
eshell-prompt-mode: t
eshell-hist-mode: t
eshell-pred-mode: t
eshell-cmpl-mode: t
eshell-proc-mode: t
eshell-arg-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mode: t
indent-tabs-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date cl-seq
em-unix em-term term shell subr-x ehelp em-script em-prompt em-ls
em-hist em-pred em-glob em-extpipe em-cmpl em-dirs esh-var pcomplete
comint ansi-osc ansi-color ring em-basic em-banner em-alias esh-mode
eshell esh-cmd generator cl-loaddefs cl-lib esh-ext esh-opt esh-proc
esh-io esh-arg esh-module esh-groups esh-util files-x rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win 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 nadvice seq simple cl-generic
indonesian philippine 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 abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty
make-network-process native-compile emacs)
Memory information:
((conses 16 77916 10347)
(symbols 48 7258 0)
(strings 32 22552 1535)
(string-bytes 1 692077)
(vectors 16 14796)
(vector-slots 8 338764 15212)
(floats 8 41 32)
(intervals 56 355 0)
(buffers 984 11))
[Message part 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
On 6/23/2024 10:56 PM, Michael Albinus via Bug reports for GNU Emacs,
the Swiss army knife of text editors wrote:
> Jim Porter <jporterbugs <at> gmail.com> writes:
>
>> I'll think about this some more and see if we can get all the checks
>> we want without making the code slower over Tramp. (Maybe Tramp caches
>> enough that this isn't a problem, but I'm not certain yet.)
>
> If Eshell calls `process-file', it shall bind `process-file-side-effects'
> to nil if appropriate for the given command.
>
> Furthermore, Eshell might bind `remote-file-name-inhibit-cache' to
> something which helps. The default value (10) seems to be very conservative.
After looking into this, it turns out Eshell doesn't look for a shebang
on remote files (a comment in 'eshell-connection-local-command' claims
that it doesn't work with Tramp syntax, but I'm not sure that's actually
correct...).
I've therefore merged the "B" variant of my patch to emacs-30 (as commit
130c3efa108) that checks for zero size on the file. I thought about it
and this way seemed safer, since I'm not sure what other scenarios might
signal a 'file-error', and I'd rather not suppress something I
shouldn't: better for a user to file another bug in that case so we can
evaluate it, I think.
Closing this bug now. (Though of course let me know if I've missed
anything here.)
This bug report was last modified 203 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.