emacs-devel
[Top][All Lists]
Advanced

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

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


From: Jim Porter
Subject: Re: Shell quoting in Eshell (was: eshell-batch-file)
Date: Sun, 9 Jun 2024 15:37:05 -0700

On 6/9/2024 1:07 PM, Jim Porter wrote:
On 6/9/2024 12:15 PM, Eli Zaretskii wrote:
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?

Hmm, I'm not immediately sure, although I have a feeling that's a bug. In particular, 'eshell-quote-argument' doesn't quote parens, which seems like a problem since that's how you write Lisp forms in Eshell. Surely we'd want to quote those. I'll take a look though, and see if I can fix things so we can use 'eshell-quote-argument' in the tests at the right spots.

Ah, I figured it out. 'eshell-quote-argument' only produces accurate results when called from inside an Eshell buffer. It also had a bug where quoting newlines didn't work properly. I've fixed the latter issue and documented/worked-around the former, and then updated the tests where appropriate.

There are just two changes you made that I'm not quite sure what to do about. When you get the chance, could you apply the following patch and report back the test failures you get?

--------------------------------------------------


diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el
index 90bbb4fa14e..6dca1f7ec1c 100644
--- a/test/lisp/eshell/esh-proc-tests.el
+++ b/test/lisp/eshell/esh-proc-tests.el
@@ -289,7 +289,7 @@ esh-proc-test/kill-pipeline
      (eshell-wait-for-subprocess t)
      (should (string-match-p
               ;; "interrupt\n" is for MS-Windows.
-              (rx (or "interrupt\n" "killed\n" "killed: 9\n" ""))
+              (rx (or "interrupt\n" "killed\n" "killed: 9\n"))
               (buffer-substring-no-properties
                output-start (eshell-end-of-output)))))))

diff --git a/test/lisp/eshell/eshell-tests-helpers.el b/test/lisp/eshell/eshell-tests-helpers.el
index acbe57a7283..bfd829c95e9 100644
--- a/test/lisp/eshell/eshell-tests-helpers.el
+++ b/test/lisp/eshell/eshell-tests-helpers.el
@@ -179,12 +179,7 @@ eshell-test-command-result

 (defun eshell-command-result--equal (_command actual expected)
   "Compare the ACTUAL result of a COMMAND with its EXPECTED value."
-  (or (equal actual expected)
-      ;; Compare case-isensitively on case-insensitive filesystems.
-      (and (memq system-type '(windows-nt ms-dos))
-           (stringp actual)
-           (stringp expected)
-           (string-equal-ignore-case actual expected))))
+  (equal actual expected))

 (defun eshell-command-result--equal-explainer (command actual expected)
   "Explain the result of `eshell-command-result--equal'."




reply via email to

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