GNU bug report logs - #55204
29.0.50; Improve quoting consistency in Eshell predicates/modifiers

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sun, 1 May 2022 04:38:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55204 in the body.
You can then email your comments to 55204 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 04:38:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jim Porter <jporterbugs <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 01 May 2022 04:38:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; Improve quoting consistency in Eshell predicates/modifiers
Date: Sat, 30 Apr 2022 21:37:20 -0700
Currently, there are some inconsistencies with how string parameters 
should be quoted in Eshell argument predicates/modifiers (hereafter just 
"predicates"). First, the possible delimiters for a given predicate vary 
based on which predicate is used. Currently, the allowed delimiters are:

Any non-digit character:
  u (user)
  g (group)
  a (access time)
  m (modification time)
  c (change time)
Any character:
  :i (include)
  :x (exclude)
  :s (substitute)
"'" or "/":
  :j (join)
  :S (split)

Relatedly, although the string parameters are parsed so that you can 
escape the delimiter with "\", the backslash isn't actually removed 
before using the parameter. For example, from "emacs -Q --eval '(eshell)':

  ~ $ echo $(list "foo" "bar")(:j'\'')
  foo\'bar

That should print "foo'bar" instead. Similarly, when redirecting output 
to a buffer, escapes aren't properly removed. Again, from "emacs -Q 
--eval '(eshell)'":

  ~ $ echo hi > #<foo\>bar>
  ;; Writes to the buffer "foo\>bar"

Patch forthcoming shortly (just getting a bug number first).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 04:51:02 GMT) Full text and rfc822 format available.

Message #8 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH] 29.0.50; Improve quoting consistency in Eshell
 predicates/modifiers
Date: Sat, 30 Apr 2022 21:50:42 -0700
[Message part 1 (text/plain, inline)]
See the attached patches. Some comments about the patch below.

On 4/30/2022 9:37 PM, Jim Porter wrote:
> Currently, there are some inconsistencies with how string parameters 
> should be quoted in Eshell argument predicates/modifiers (hereafter just 
> "predicates"). First, the possible delimiters for a given predicate vary 
> based on which predicate is used. Currently, the allowed delimiters are:
> 
> Any non-digit character:
>    u (user)
>    g (group)
>    a (access time)
>    m (modification time)
>    c (change time)
> Any character:
>    :i (include)
>    :x (exclude)
>    :s (substitute)
> "'" or "/":
>    :j (join)
>    :S (split)

To resolve this, I've standardized on using the following delimiter 
pairs: "...", '...', /.../, |...|, (...), [...], <...>, and {...}. This 
is a smaller valid set than what's was allowed for some of the above 
predicates, but is still considerably more than what was actually 
documented (just '...' and /.../). I've updated the manual to list the 
accepted delimiters, but maybe we should add more to the list. However, 
since some predicates take an *optional* string parameter, it's best not 
to be too loose with acceptable delimiters so that there isn't 
confusion; this is already a problem with "/", since that could be a 
string delimiter *or* a predicate meaning "match directories", but it'd 
be too hard to change either of those at this point. (Users can avoid 
this issue by being careful about the order they write their predicates in.)

I'm not sure if this change warrants a NEWS entry. On the one hand, it's 
just a bug fix, but on the other hand, it's an incompatible change. On 
the third(?) hand, it was never documented, and I'm not sure if anyone 
would have guessed that you can use, say, alphabetic characters as 
string delimiters in predicates.
[0001-Use-a-common-set-of-string-delimiters-for-all-Eshell.patch (text/plain, attachment)]
[0002-Handle-escaped-characters-in-Eshell-argument-predica.patch (text/plain, attachment)]
[0003-Handle-escaped-characters-in-Eshell-special-referenc.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 08:41:02 GMT) Full text and rfc822 format available.

Message #11 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: 29.0.50; Improve quoting consistency in Eshell
 predicates/modifiers
Date: Sun, 01 May 2022 10:40:03 +0200
Jim Porter <jporterbugs <at> gmail.com> writes:

> I'm not sure if this change warrants a NEWS entry. On the one hand,
> it's just a bug fix, but on the other hand, it's an incompatible
> change. On the third(?) hand, it was never documented, and I'm not
> sure if anyone would have guessed that you can use, say, alphabetic
> characters as string delimiters in predicates.

I think it warrants a NEWS entry -- some people may have used
undocumented values.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:19:02 GMT) Full text and rfc822 format available.

Message #14 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 1 May 2022 11:18:49 -0700
[Message part 1 (text/plain, inline)]
On 5/1/2022 1:40 AM, Lars Ingebrigtsen wrote:
> Jim Porter <jporterbugs <at> gmail.com> writes:
> 
>> I'm not sure if this change warrants a NEWS entry. On the one hand,
>> it's just a bug fix, but on the other hand, it's an incompatible
>> change. On the third(?) hand, it was never documented, and I'm not
>> sure if anyone would have guessed that you can use, say, alphabetic
>> characters as string delimiters in predicates.
> 
> I think it warrants a NEWS entry -- some people may have used
> undocumented values.

Ok, updated (only the first patch has any changes). Hopefully the 
wording is ok.

I've also moved a stray Eshell entry from the "Lisp Changes" section 
into the Eshell subsection of "Changes in Specialized Modes". It was 
more of a user-facing change, so it's probably best to put it there 
alongside all the other similar changes (I added a pointer to the manual 
section too).
[0001-Use-a-common-set-of-string-delimiters-for-all-Eshell.patch (text/plain, attachment)]
[0002-Handle-escaped-characters-in-Eshell-argument-predica.patch (text/plain, attachment)]
[0003-Handle-escaped-characters-in-Eshell-special-referenc.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:23:01 GMT) Full text and rfc822 format available.

Message #17 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 01 May 2022 20:22:43 +0200
Jim Porter <jporterbugs <at> gmail.com> writes:

> I've also moved a stray Eshell entry from the "Lisp Changes" section
> into the Eshell subsection of "Changes in Specialized Modes". It was
> more of a user-facing change, so it's probably best to put it there
> alongside all the other similar changes (I added a pointer to the
> manual section too).

Thanks; looks good.  But this leads to a couple of test failures, like
the one below.  (Note -- this doesn't fail when "make eshell-tests", but
with "make check".)

Test eshell-test/redirect-buffer backtrace:
  signal(ert-test-failed (((should (equal (buffer-string) "hi")) :form
  ert-fail(((should (equal (buffer-string) "hi")) :form (equal "" "hi"
  #f(compiled-function () #<bytecode 0xb0e2b90f44d2f2e>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name eshell-test/redirect-buffer :document
  ert-run-or-rerun-test(#s(ert--stats :selector (not ...) :tests [... 
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable) (tag :n
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable) (
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/eshell/eshell-tests"
  command-line()
  normal-top-level()
Test eshell-test/redirect-buffer condition:
    (ert-test-failed
     ((should
       (equal
	(buffer-string)
	"hi"))
      :form
      (equal "" "hi")
      :value nil :explanation
      (arrays-of-different-length 0 2 "" "hi" first-mismatch-at 0)))
   FAILED  19/25  eshell-test/redirect-buffer (0.001028 sec) at lisp/eshell/eshell-tests.el:117
Test eshell-test/redirect-buffer-escaped backtrace:


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:37:01 GMT) Full text and rfc822 format available.

Message #20 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 1 May 2022 11:36:19 -0700
On 5/1/2022 11:22 AM, Lars Ingebrigtsen wrote:
> Thanks; looks good.  But this leads to a couple of test failures, like
> the one below.  (Note -- this doesn't fail when "make eshell-tests", but
> with "make check".)
> 
> Test eshell-test/redirect-buffer backtrace:
>    signal(ert-test-failed (((should (equal (buffer-string) "hi")) :form
[snip]

This looks like it might be due to the change I made in 
`with-temp-eshell' in test/lisp/eshell/eshell-tests-helpers.el. Does it 
work if you run `rm test/lisp/eshell/*.elc' first? The failure may just 
be due to stale bytecode.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:41:02 GMT) Full text and rfc822 format available.

Message #23 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 01 May 2022 20:40:13 +0200
Jim Porter <jporterbugs <at> gmail.com> writes:

> This looks like it might be due to the change I made in
> `with-temp-eshell' in test/lisp/eshell/eshell-tests-helpers.el. Does
> it work if you run `rm test/lisp/eshell/*.elc' first? The failure may
> just be due to stale bytecode.

I tried that, but it didn't help.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:42:02 GMT) Full text and rfc822 format available.

Message #26 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 01 May 2022 20:41:01 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Jim Porter <jporterbugs <at> gmail.com> writes:
>
>> This looks like it might be due to the change I made in
>> `with-temp-eshell' in test/lisp/eshell/eshell-tests-helpers.el. Does
>> it work if you run `rm test/lisp/eshell/*.elc' first? The failure may
>> just be due to stale bytecode.
>
> I tried that, but it didn't help.

Oh, sorry -- I misread.  I tried deleting the .elc files in the lisp
dir, not the test dir.  Let me try again.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 18:43:01 GMT) Full text and rfc822 format available.

Message #29 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 01 May 2022 20:42:47 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Oh, sorry -- I misread.  I tried deleting the .elc files in the lisp
> dir, not the test dir.  Let me try again.

Yup; works fine; now pushed.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug marked as fixed in version 29.1, send any further explanations to 55204 <at> debbugs.gnu.org and Jim Porter <jporterbugs <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 01 May 2022 18:44:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#55204; Package emacs. (Sun, 01 May 2022 23:56:02 GMT) Full text and rfc822 format available.

Message #34 received at 55204 <at> debbugs.gnu.org (full text, mbox):

From: Jim Porter <jporterbugs <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 55204 <at> debbugs.gnu.org
Subject: Re: bug#55204: [PATCH v2] 29.0.50; Improve quoting consistency in
 Eshell predicates/modifiers
Date: Sun, 1 May 2022 16:55:15 -0700
On 5/1/2022 11:42 AM, Lars Ingebrigtsen wrote:
> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
> 
>> Oh, sorry -- I misread.  I tried deleting the .elc files in the lisp
>> dir, not the test dir.  Let me try again.
> 
> Yup; works fine; now pushed.

Cool, glad that's all it needed. Thanks for merging.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 30 May 2022 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 330 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.