all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Jim Porter <jporterbugs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Shell quoting in Eshell (was: eshell-batch-file)
Date: Sun, 09 Jun 2024 22:15:15 +0300	[thread overview]
Message-ID: <86bk4a9bcs.fsf@gnu.org> (raw)
In-Reply-To: <6a0e51ee-f4a2-c668-fcc7-eb83954539d5@gmail.com> (message from Jim Porter on Sun, 9 Jun 2024 11:55:22 -0700)

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.



  parent reply	other threads:[~2024-06-09 19:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-09  6:11 eshell-batch-file Eli Zaretskii
2024-06-09 18:55 ` eshell-batch-file Jim Porter
2024-06-09 19:06   ` eshell-batch-file Eli Zaretskii
2024-06-09 19:15   ` Eli Zaretskii [this message]
2024-06-09 20:07     ` Shell quoting in Eshell (was: eshell-batch-file) Jim Porter
2024-06-09 22:37       ` Jim Porter
2024-06-15  9:38         ` Eli Zaretskii
2024-06-15 18:36           ` Jim Porter
2024-06-15 19:10             ` Eli Zaretskii
2024-06-15 20:06               ` Jim Porter
2024-06-16  5:21                 ` Eli Zaretskii
2024-06-16  5:57                   ` Jim Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86bk4a9bcs.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.