GNU bug report logs -
#55838
29.0.50; Eshell string-split subscript indexing splits too much
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Wed, 8 Jun 2022 01:37: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.
Full log
Message #16 received at 55838 <at> debbugs.gnu.org (full text, mbox):
> From: Jim Porter <jporterbugs <at> gmail.com>
> Date: Tue, 7 Jun 2022 18:41:30 -0700
>
> > The first command is normal, and just shows that Eshell outputs the
> > string with no manipulation. In the second command, we split the string
> > on ":" and get the 0th element. However, that gets split *again* (on
> > newlines) and returns a list.
>
> Here's a patch for this. It changes the behavior of
> `eshell-apply-indices' to use `eshell-convert-to-number' (when the
> expansion isn't wrapped in double-quotes) instead of the more-aggressive
> `eshell-convert'. I think `eshell-convert-to-number' is the right thing
> here, since Eshell already converts number-like strings to actual
> numbers in most cases.
>
> As a note, if you wanted the old behavior, you could do something like this:
>
> ~ $ echo $foo[: 0][0 1]
> ("a" "b")
>
> There's also a suggestion in the "Bugs and ideas" section of the Eshell
> manual to add "*" as a subscript to mean "all indices", so you could do
> the above in a more generic fashion like:
>
> ~ $ echo $foo[: 0][*]
> ;; Doesn't currently work, but it could.
I don't have any objections based on actual experience, and I don't
know what was the original design goals of this feature in Eshell.
However, please note that you are changing the behavior significantly,
and the only reason is that it doesn't make much sense to you. I
wonder whether this is a strong enough motivation to make such
incompatible behavior changes. Eshell is not a "normal" shell, in
that it attempts to make sense even if Lisp expressions are mixed with
Posix-ish shell features, so what may not make sense in Bash, Zsh, and
their ilk is not necessarily nonsensical in Eshell.
So maybe we should raise the bar for considering reasons for behavior
changes as valid?
This bug report was last modified 2 years and 347 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.