GNU bug report logs -
#59622
29.0.50; [PATCH] Regression in Eshell's handling of escaped newlines
Previous Next
Reported by: Jim Porter <jporterbugs <at> gmail.com>
Date: Sun, 27 Nov 2022 00:38:01 UTC
Severity: normal
Tags: patch
Found in version 29.0.50
Done: Jim Porter <jporterbugs <at> gmail.com>
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 59622 in the body.
You can then email your comments to 59622 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Sun, 27 Nov 2022 00:38:02 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, 27 Nov 2022 00:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Starting from "emacs -Q -f eshell":
# Emacs 28
~ $ echo foo\
bar
foobar
# Emacs 29
~ $ echo foo\
bar
foo
bar
That is, Emacs 28 used to treat escaped newlines in the way you'd expect
from other shells: it expands to the empty string. Now in Emacs 29, it
inserts a literal newline.
There's also a similar bug when doing this inside double-quotes:
# Emacs 28
~ $ echo "foo\
bar"
("foo\\" "bar")
# Emacs 29
~ $ echo "foo\
bar"
foo\
bar
Here, both cases are wrong. In Emacs 29, it inserts the literal
backslash+newline combo, but Emacs 28 is even worse: it returns a list
of two elements! Wrapping arguments in quotes should always produce a
string in Eshell.
[0001-Treat-escaped-newlines-in-Eshell-as-the-empty-string.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Sun, 27 Nov 2022 00:43:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 59622 <at> debbugs.gnu.org (full text, mbox):
On 11/26/2022 4:36 PM, Jim Porter wrote:
> ~ $ echo foo\
> bar
[snip]
> ~ $ echo "foo\
> bar"
Sorry, I forgot to mention: the new behavior with my patch in both cases
above is to print "foobar" as a single word.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Sun, 04 Dec 2022 01:42:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 59622 <at> debbugs.gnu.org (full text, mbox):
On 11/26/2022 4:36 PM, Jim Porter wrote:
> Starting from "emacs -Q -f eshell":
>
> # Emacs 28
> ~ $ echo foo\
> bar
>
> foobar
>
> # Emacs 29
> ~ $ echo foo\
> bar
>
> foo
> bar
>
> That is, Emacs 28 used to treat escaped newlines in the way you'd expect
> from other shells: it expands to the empty string. Now in Emacs 29, it
> inserts a literal newline.
Eli, since this is a regression from Emacs 28 (likely fallout from one
of my changes to fix some longstanding bugs with quotes in Eshell),
would my current patch be ok on the release branch? I can try to
minimize the changes a bit further (I slightly refactored
'eshell-parse-backslash' to reduce repetition), but since it has unit
tests, I think it should be pretty safe either way.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Sun, 04 Dec 2022 07:27:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 59622 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 3 Dec 2022 17:41:50 -0800
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 11/26/2022 4:36 PM, Jim Porter wrote:
> > Starting from "emacs -Q -f eshell":
> >
> > # Emacs 28
> > ~ $ echo foo\
> > bar
> >
> > foobar
> >
> > # Emacs 29
> > ~ $ echo foo\
> > bar
> >
> > foo
> > bar
> >
> > That is, Emacs 28 used to treat escaped newlines in the way you'd expect
> > from other shells: it expands to the empty string. Now in Emacs 29, it
> > inserts a literal newline.
>
> Eli, since this is a regression from Emacs 28 (likely fallout from one
> of my changes to fix some longstanding bugs with quotes in Eshell),
> would my current patch be ok on the release branch?
Yes, but please do try to make it as safe as is feasible.
> I can try to minimize the changes a bit further (I slightly refactored
> 'eshell-parse-backslash' to reduce repetition), but since it has unit
> tests, I think it should be pretty safe either way.
OK.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Mon, 05 Dec 2022 01:36:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 59622 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 12/3/2022 11:26 PM, Eli Zaretskii wrote:
>> Date: Sat, 3 Dec 2022 17:41:50 -0800
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> Eli, since this is a regression from Emacs 28 (likely fallout from one
>> of my changes to fix some longstanding bugs with quotes in Eshell),
>> would my current patch be ok on the release branch?
>
> Yes, but please do try to make it as safe as is feasible.
Thanks. How does this look? I just simplified the change in
'eshell-parse-backslash' so that the only difference is an extra
conditional (plus whitespace changes).
[0001-Treat-escaped-newlines-in-Eshell-as-the-empty-string.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Mon, 05 Dec 2022 12:40:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 59622 <at> debbugs.gnu.org (full text, mbox):
> Date: Sun, 4 Dec 2022 17:35:30 -0800
> Cc: 59622 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 12/3/2022 11:26 PM, Eli Zaretskii wrote:
> >> Date: Sat, 3 Dec 2022 17:41:50 -0800
> >> From: Jim Porter <jporterbugs <at> gmail.com>
> >>
> >> Eli, since this is a regression from Emacs 28 (likely fallout from one
> >> of my changes to fix some longstanding bugs with quotes in Eshell),
> >> would my current patch be ok on the release branch?
> >
> > Yes, but please do try to make it as safe as is feasible.
>
> Thanks. How does this look? I just simplified the change in
> 'eshell-parse-backslash' so that the only difference is an extra
> conditional (plus whitespace changes).
Looks good, thanks. One comment:
> +When you escape a character with @code{\} outside of quotes, the
> +result is the literal character immediately following it, so
> +@samp{\$10} means the literal string @code{$10}. Inside of
> +double quotes, the result is the literal character following it if
> +that character is special, or the full @code{\@var{c}} sequence
> +otherwise; inside double-quotes, @code{\}, @code{"}, and @code{$} are
> +considered special.
The last sentence is very unclear, please try saying what you need in a
clearer way, and/or maybe add a couple of examples.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Wed, 07 Dec 2022 04:19:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 59622 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On 12/5/2022 4:39 AM, Eli Zaretskii wrote:
>> +When you escape a character with @code{\} outside of quotes, the
>> +result is the literal character immediately following it, so
>> +@samp{\$10} means the literal string @code{$10}. Inside of
>> +double quotes, the result is the literal character following it if
>> +that character is special, or the full @code{\@var{c}} sequence
>> +otherwise; inside double-quotes, @code{\}, @code{"}, and @code{$} are
>> +considered special.
>
> The last sentence is very unclear, please try saying what you need in a
> clearer way, and/or maybe add a couple of examples.
Ok, I expanded that part of the manual and added a few more examples.
How does this look?
I also split the patch in two: the first patch for the 29 branch (which
makes the least code changes I could manage), and the second as an
additional small cleanup patch for master only.
[29.1--0001-Treat-escaped-newlines-in-Eshell-as-the-empty-string.patch (text/plain, attachment)]
[master--0002-Reorganize-the-conditionals-in-eshell-parse-backslas.patch (text/plain, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Wed, 07 Dec 2022 13:35:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 59622 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 6 Dec 2022 20:18:30 -0800
> Cc: 59622 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> > The last sentence is very unclear, please try saying what you need in a
> > clearer way, and/or maybe add a couple of examples.
>
> Ok, I expanded that part of the manual and added a few more examples.
> How does this look?
Much better, thanks.
> I also split the patch in two: the first patch for the 29 branch (which
> makes the least code changes I could manage), and the second as an
> additional small cleanup patch for master only.
Since which Emacs version do we have this regression? If it's a very
old regression, I'd prefer not to fix it on the emacs-29 branch.
> @subsection Quoting and escaping
> As with other shells, you can escape special characters and spaces
> -with by prefixing the character with a backslash (@code{\}), or by
> -surrounding the string with apostrophes (@code{''}) or double quotes
> -(@code{""}). This is needed especially for file names with special
> -characters like pipe (@code{|}), which could be part of remote file
> +with by prefixing the character with a backslash (@samp{\}), or by
"with by prefixing" is a typo; probably "with" should be dropped.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Wed, 07 Dec 2022 17:59:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 59622 <at> debbugs.gnu.org (full text, mbox):
On 12/7/2022 5:34 AM, Eli Zaretskii wrote:
>> Date: Tue, 6 Dec 2022 20:18:30 -0800
>> Cc: 59622 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> I also split the patch in two: the first patch for the 29 branch (which
>> makes the least code changes I could manage), and the second as an
>> additional small cleanup patch for master only.
>
> Since which Emacs version do we have this regression? If it's a very
> old regression, I'd prefer not to fix it on the emacs-29 branch.
This worked properly in Emacs 28 and is broken in 29. I'm not 100% sure
which patch regressed it, but my guess is patch 0003 in bug#54227, which
was merged in March.
>> @subsection Quoting and escaping
>> As with other shells, you can escape special characters and spaces
>> -with by prefixing the character with a backslash (@code{\}), or by
>> -surrounding the string with apostrophes (@code{''}) or double quotes
>> -(@code{""}). This is needed especially for file names with special
>> -characters like pipe (@code{|}), which could be part of remote file
>> +with by prefixing the character with a backslash (@samp{\}), or by
>
> "with by prefixing" is a typo; probably "with" should be dropped.
Good catch! I missed that despite reading it a few times while editing
the manual.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Wed, 07 Dec 2022 18:11:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 59622 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 7 Dec 2022 09:57:59 -0800
> Cc: 59622 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs <at> gmail.com>
>
> On 12/7/2022 5:34 AM, Eli Zaretskii wrote:
> >> Date: Tue, 6 Dec 2022 20:18:30 -0800
> >> Cc: 59622 <at> debbugs.gnu.org
> >> From: Jim Porter <jporterbugs <at> gmail.com>
> >>
> >> I also split the patch in two: the first patch for the 29 branch (which
> >> makes the least code changes I could manage), and the second as an
> >> additional small cleanup patch for master only.
> >
> > Since which Emacs version do we have this regression? If it's a very
> > old regression, I'd prefer not to fix it on the emacs-29 branch.
>
> This worked properly in Emacs 28 and is broken in 29. I'm not 100% sure
> which patch regressed it, but my guess is patch 0003 in bug#54227, which
> was merged in March.
Then we must fix the regression on the emacs-29 branch.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#59622
; Package
emacs
.
(Thu, 08 Dec 2022 05:48:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 59622 <at> debbugs.gnu.org (full text, mbox):
On 12/7/2022 10:10 AM, Eli Zaretskii wrote:
>> Date: Wed, 7 Dec 2022 09:57:59 -0800
>> Cc: 59622 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs <at> gmail.com>
>>
>> This worked properly in Emacs 28 and is broken in 29. I'm not 100% sure
>> which patch regressed it, but my guess is patch 0003 in bug#54227, which
>> was merged in March.
>
> Then we must fix the regression on the emacs-29 branch.
>
> Thanks.
Thanks, that sounds right to me too. I've merged this (just the first
patch with the fix) to the emacs-29 branch as
cf5ce14a6b442649426003fed8dc02ee7edca914.
I'll leave this open until I merge the small cleanup patch to master
once my first patch has gotten there.
Reply sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
You have taken responsibility.
(Fri, 09 Dec 2022 01:01:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Jim Porter <jporterbugs <at> gmail.com>
:
bug acknowledged by developer.
(Fri, 09 Dec 2022 01:01:02 GMT)
Full text and
rfc822 format available.
Message #40 received at 59622-done <at> debbugs.gnu.org (full text, mbox):
On 12/7/2022 9:47 PM, Jim Porter wrote:
> I'll leave this open until I merge the small cleanup patch to master
> once my first patch has gotten there.
Pushed my followup patch to master as
8c01829c01ca81c990eadf34bc16794b65d62c70. Closing this now.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 06 Jan 2023 12:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 104 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.