emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Shell quoting in Eshell (was: eshell-batch-file)


From: Eli Zaretskii
Subject: Shell quoting in Eshell (was: eshell-batch-file)
Date: Sun, 09 Jun 2024 22:15:15 +0300

Jim,

As long as I have your attention: there's a subtle point with using
shell-quote-argument with Eshell.  By default, that function adapts
itself to the system's default shell.  In particular, on Windows the
quoting is as expected by cmd.exe and the startup code of Windows
programs.  This is TRT when invoking the external shell, but it is
wrong when invoking programs via Eshell, because Eshell implements
quoting rules of a Posix shell.  So in many cases one needs to call
shell-quote-argument with its 2nd argument non-nil.  The problem, in
particular with the Eshell test suite, is that that the same utility
functions are used with many different commands and many different
situations, and so in general it is almost impossible to fix this
inside the utility function which actually quotes the arguments,
because the function doesn't know how will the command be called and
even what are the arguments it is quoting.

Curiously, there is already eshell-quote-argument, but it doesn't
produce the same effect as shell-quote-argument with 2nd arg non-nil,
which is why in esh-proc-tests.el I couldn't use
eshell-quote-argument.  Any idea why eshell-quote-argument is
different?

In any case, I suggest at some point to discuss how to handle quoting
in a more systematic way, because it was a cause of constant problems
when I ran the Eshell tests today and fixed those which failed.

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]