GNU bug report logs - #54470
29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion

Previous Next

Package: emacs;

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

Date: Sun, 20 Mar 2022 01:35:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#54470: closed (29.0.50; [PATCH] Add documentation/tests for
 Eshell argument expansion)
Date: Sun, 17 Apr 2022 07:34:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 17 Apr 2022 10:32:42 +0300
with message-id <834k2syxk5.fsf <at> gnu.org>
and subject line Re: bug#54470: 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion
has caused the debbugs.gnu.org bug report #54470,
regarding 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
54470: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54470
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; [PATCH] Add documentation/tests for Eshell argument expansion
Date: Sat, 19 Mar 2022 18:34:44 -0700
[Message part 3 (text/plain, inline)]
Eshell supports a few ways of expanding and manipulating arguments: 
globs (which most people are likely familiar with from other shells), as 
well as predicates (which let you filter lists of file names based on 
the files' properties) and modifiers (which perform common 
transformations, mostly on lists). However, these lack unit tests and 
are currently only documented in the manual as follows:

  Eshell’s globbing syntax is very similar to that of Zsh.  Users coming
  from Bash can still use Bash-style globbing, as there are no
  incompatibilities.  Most globbing is pattern-based expansion, but
  there is also predicate-based expansion. See Filename Generation in
  The Z Shell Manual, for full syntax.

As the manual says, the syntax is "similar"; it's not actually the same. 
It also doesn't mention argument modifiers, which are related to 
predicates, but let you do different things. I think it would be best to 
fully-document the syntax so that the Eshell-specific bits are clear. 
Attached are some patches to add documentation and tests for this.

For globbing, I only added tests/documentation, but for predicates and 
modifiers, I found a few bugs as well. I'll describe each of them:

1. The "is a socket" predicate conflicts with the "is setuid" predicate 
(both are `s'), meaning that it's impossible to filter on the setuid 
bit. I've updated the "is a socket" predicate to be `=', matching zsh.

2. The "join" (`j') modifier was documented as joining a list and 
separating the element by a space, but it actually joined the list with 
no separator. It now behaves according to the documentation.

3. The "eval again" (`E') modifier didn't work; it called 
`eshell-parse-argument' with one argument, but that function takes no 
args. I've fixed this, though I had to make an educated guess on what 
the behavior should be. I chose the behavior closest to what the 
previous implementation looked like it was trying to do: re-evaluate the 
value as though it were a single argument (another option would be to 
re-evaluate as though it were a full shell command, i.e. to invoke a 
program). I've documented the behavior in the manual, so hopefully that 
will explain how it works.

Finally, I added support for the "is effective gid" predicate (`G'). 
That was already there, but commented out. It just needed uncommenting 
and the uid parts renamed to gid. I'm not sure if there was some reason 
for it to be commented out, but it works fine in my tests.

Hopefully the documentation I've added is structured/worded reasonably 
well. I did my best to follow existing conventions despite the 
very-different syntax (especially for predicates/modifiers), and tried 
to give a reasonable level of detail for all the options. If there's 
anything that's confusing or needs expanded, just let me know and I'll 
try to improve it.

Finally, I'm not sure if any of the behavior changes should be 
documented in NEWS. `G' ("is effective gid") is a small new feature, and 
the change from `s' to `=' for "is a socket" and the change for `j' 
(join) are technically incompatible changes, although maybe they're 
obscure enough that they don't need NEWS entries. I'll do whatever 
others think is best here.
[0001-Add-unit-tests-and-documentation-for-Eshell-pattern-.patch (text/plain, attachment)]
[0002-Add-unit-tests-and-documentation-for-Eshell-predicat.patch (text/plain, attachment)]
[0003-Add-G-argument-predicate-in-Eshell.patch (text/plain, attachment)]
[Message part 7 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Jim Porter <jporterbugs <at> gmail.com>
Cc: 54470-done <at> debbugs.gnu.org
Subject: Re: bug#54470: 29.0.50; [PATCH] Add documentation/tests for Eshell
 argument expansion
Date: Sun, 17 Apr 2022 10:32:42 +0300
> Cc: 54470 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
> Date: Sat, 16 Apr 2022 10:14:43 -0700
> 
> >> Can you try the attached patch to see if the tests pass? If it works,
> >> I'll fold it into the previous patches and resubmit them. (It works for
> >> me on an MS Windows system, but I don't have build tools on it, so I
> >> just used the binary release of 28.1 with some of the bits copied from
> >> my patches to test it out.)
> > 
> > Yes, this fixes the failures, thanks.
> 
> Cool, thanks. Here are final patches for merging then (only the second 
> patch is changed from before, but I attached the full series for 
> convenience).

Thanks, installed on the master branch, and closing the bug.

Please in the future always mention the bug number in the commit log
messages (I added that for you in this case).


This bug report was last modified 3 years and 36 days ago.

Previous Next


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