* bug#73952: 30.0.91; [PATCH] Fix error when an Eshell glob has no results and 'eshell-glob-splice-results' is t
@ 2024-10-22 16:57 Jim Porter
2024-10-22 17:43 ` Eli Zaretskii
0 siblings, 1 reply; 3+ messages in thread
From: Jim Porter @ 2024-10-22 16:57 UTC (permalink / raw)
To: 73952; +Cc: eliz
[-- Attachment #1: Type: text/plain, Size: 581 bytes --]
X-Debbugs-CC: eliz@gnu.org
Starting from "emacs -Q -f eshell":
~ $ (setq eshell-glob-splice-results t)
t
~ $ echo /ssh:localhost:~/file.txt
/ssh:localhost:~/file.txt
~ $ echo /ssh:localhost:~/file.txt
Wrong type argument: listp, "/ssh:localhost:~/file.txt"
The third command should have the same result as the second (the second
works because Tramp isn't loaded yet at the time).
This is a bug in a new Eshell feature in Emacs 30 and thankfully has an
easy fix (see attached). Eli, is this ok for the release branch? I added
a regression test for this too.
[-- Attachment #2: 0001-Fix-error-when-splicing-Eshell-globs-and-a-glob-expa.patch --]
[-- Type: text/plain, Size: 3438 bytes --]
From b7a375f5c49ac86399b9af7a6a74720ed294abd7 Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Tue, 22 Oct 2024 09:43:00 -0700
Subject: [PATCH] Fix error when splicing Eshell globs and a glob expands to
itself
This could happen when 'eshell-extended-glob' determines that a "glob"
is not really a glob. This mainly happens for remote file names with a
"~" in them, like "/ssh:remote:~/file.txt".
* lisp/eshell/em-glob.el (eshell-extended-glob): Return a list when
'eshell-glob-splice-results' is non-nil.
* test/lisp/eshell/em-glob-tests.el
(em-glob-test/expand/splice-results)
em-glob-test/expand/no-splice-results): Extend tests.
---
lisp/eshell/em-glob.el | 2 +-
test/lisp/eshell/em-glob-tests.el | 16 +++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index 36e4f90aed2..2aceaf188f3 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -348,7 +348,7 @@ eshell-extended-glob
;; always be sure if the "~" is a home directory reference or
;; part of a glob (e.g. if the argument was assembled from
;; variables).
- glob
+ (if eshell-glob-splice-results (list glob) glob)
(unwind-protect
(apply #'eshell-glob-entries globs)
(if message-shown
diff --git a/test/lisp/eshell/em-glob-tests.el b/test/lisp/eshell/em-glob-tests.el
index 2efb3a9df69..88e9cc73bbd 100644
--- a/test/lisp/eshell/em-glob-tests.el
+++ b/test/lisp/eshell/em-glob-tests.el
@@ -74,7 +74,13 @@ em-glob-test/expand/splice-results
;; Ensure the default expansion splices the glob.
(eshell-command-result-equal "funcall list *.el" '("a.el" "b.el"))
(eshell-command-result-equal "funcall list *.txt" '("c.txt"))
- (eshell-command-result-equal "funcall list *.no" '("*.no")))))
+ ;; When spliting, no-matches cases also return a list containing
+ ;; the original non-matching glob.
+ (eshell-command-result-equal "funcall list *.no" '("*.no"))
+ (when (eshell-tests-remote-accessible-p)
+ (let ((remote (file-remote-p ert-remote-temporary-file-directory)))
+ (eshell-command-result-equal (format "funcall list %s~/a.el" remote)
+ `(,(format "%s~/a.el" remote))))))))
(ert-deftest em-glob-test/expand/no-splice-results ()
"Test that globs are treated as lists when
@@ -85,9 +91,13 @@ em-glob-test/expand/no-splice-results
;; Ensure the default expansion splices the glob.
(eshell-command-result-equal "funcall list *.el" '(("a.el" "b.el")))
(eshell-command-result-equal "funcall list *.txt" '(("c.txt")))
- ;; The no-matches case is special here: the glob is just the
+ ;; The no-matches cases are special here: the glob is just the
;; string, not the list of results.
- (eshell-command-result-equal "funcall list *.no" '("*.no")))))
+ (eshell-command-result-equal "funcall list *.no" '("*.no"))
+ (when (eshell-tests-remote-accessible-p)
+ (let ((remote (file-remote-p ert-remote-temporary-file-directory)))
+ (eshell-command-result-equal (format "funcall list %s~/a.el" remote)
+ `(,(format "%s~/a.el" remote))))))))
(ert-deftest em-glob-test/expand/explicitly-splice-results ()
"Test explicitly splicing globs works the same no matter the
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#73952: 30.0.91; [PATCH] Fix error when an Eshell glob has no results and 'eshell-glob-splice-results' is t
2024-10-22 16:57 bug#73952: 30.0.91; [PATCH] Fix error when an Eshell glob has no results and 'eshell-glob-splice-results' is t Jim Porter
@ 2024-10-22 17:43 ` Eli Zaretskii
2024-10-22 21:31 ` Jim Porter
0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2024-10-22 17:43 UTC (permalink / raw)
To: Jim Porter; +Cc: 73952
> Cc: eliz@gnu.org
> Date: Tue, 22 Oct 2024 09:57:42 -0700
> From: Jim Porter <jporterbugs@gmail.com>
>
> ~ $ (setq eshell-glob-splice-results t)
> t
> ~ $ echo /ssh:localhost:~/file.txt
> /ssh:localhost:~/file.txt
> ~ $ echo /ssh:localhost:~/file.txt
> Wrong type argument: listp, "/ssh:localhost:~/file.txt"
>
> The third command should have the same result as the second (the second
> works because Tramp isn't loaded yet at the time).
>
> This is a bug in a new Eshell feature in Emacs 30 and thankfully has an
> easy fix (see attached). Eli, is this ok for the release branch?
Yes, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#73952: 30.0.91; [PATCH] Fix error when an Eshell glob has no results and 'eshell-glob-splice-results' is t
2024-10-22 17:43 ` Eli Zaretskii
@ 2024-10-22 21:31 ` Jim Porter
0 siblings, 0 replies; 3+ messages in thread
From: Jim Porter @ 2024-10-22 21:31 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 73952-done
On 10/22/2024 10:43 AM, Eli Zaretskii wrote:
>> Cc: eliz@gnu.org
>> Date: Tue, 22 Oct 2024 09:57:42 -0700
>> From: Jim Porter <jporterbugs@gmail.com>
>>
>> This is a bug in a new Eshell feature in Emacs 30 and thankfully has an
>> easy fix (see attached). Eli, is this ok for the release branch?
>
> Yes, thanks.
Thanks. Merged to the release branch as b7a375f5c49, and closing this now.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-22 21:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-22 16:57 bug#73952: 30.0.91; [PATCH] Fix error when an Eshell glob has no results and 'eshell-glob-splice-results' is t Jim Porter
2024-10-22 17:43 ` Eli Zaretskii
2024-10-22 21:31 ` Jim Porter
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.