GNU bug report logs - #40239
Bug in how \cregexpc is handled

Previous Next

Package: sed;

Reported by: Enrico Maria De Angelis <enricomaria.dean6elis <at> gmail.com>

Date: Thu, 26 Mar 2020 15:30:01 UTC

Severity: normal

Tags: confirmed

Merged with 40242

Done: Jim Meyering <jim <at> meyering.net>

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 40239 in the body.
You can then email your comments to 40239 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-sed <at> gnu.org:
bug#40239; Package sed. (Thu, 26 Mar 2020 15:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Enrico Maria De Angelis <enricomaria.dean6elis <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-sed <at> gnu.org. (Thu, 26 Mar 2020 15:30:02 GMT) Full text and rfc822 format available.

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

From: Enrico Maria De Angelis <enricomaria.dean6elis <at> gmail.com>
To: bug-sed <at> gnu.org
Subject: Bug in how \cregexpc is handled
Date: Thu, 26 Mar 2020 14:18:28 +0000
[Message part 1 (text/plain, inline)]
To whom it may concern,

From man sed, I read:
       \cregexpc
              Match lines matching the regular expression regexp.  The c
may be any character.
On the one hand

   - sed '\cncd' <<< n correctly shows empty output, since it's the same as sed
   '/n/d' <<< n based on the description above;
   - sed '\c\ccd' <<< c correctly shows an empty output too, but in this
   case the letter needed to be escaped for obvious reasons.

 On the other hand:

   - sed '\n\nnd' <<< n results in an output equal to the single character n,
   revealing that the backslash is having a double effect:
      1. it prevents the following n from closing the opening \n.
      2. it interprets the n as a newline instead of the literal letter n;
      this is confirmed by executing echo -e 'a\na' | sed -n 'N;\n\nnp'.

The is means that using n in \nregexpn prevevents the use of the literal n
in the regexp.

The issue has come to light in this StackOverflow
<https://stackoverflow.com/questions/60853746/what-is-n-nnd-supposed-to-do>
question.

Kind regards,
Enrico Maria De Angelis
[Message part 2 (text/html, inline)]

Information forwarded to bug-sed <at> gnu.org:
bug#40239; Package sed. (Tue, 31 Mar 2020 04:48:02 GMT) Full text and rfc822 format available.

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

From: Assaf Gordon <assafgordon <at> gmail.com>
To: Enrico Maria De Angelis <enricomaria.dean6elis <at> gmail.com>,
 40239 <at> debbugs.gnu.org
Subject: Re: bug#40239: Bug in how \cregexpc is handled
Date: Mon, 30 Mar 2020 22:47:01 -0600
merge 40239 40242
stop

Hello,


On 2020-03-26 8:18 a.m., Enrico Maria De Angelis wrote:
[...]
> The is means that using n in \nregexpn prevevents the use of the literal n
> in the regexp.
> 
> The issue has come to light in this StackOverflow
> <https://stackoverflow.com/questions/60853746/what-is-n-nnd-supposed-to-do>
> question.

Thank you for the report.

The original poster (Oguz Ismail) sent a similar issue, please
see the reply there:
 http://debbugs.gnu.org/40242

regards,
 - assaf




Merged 40239 40242. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 31 Mar 2020 04:48:02 GMT) Full text and rfc822 format available.

Added tag(s) confirmed. Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Tue, 31 Mar 2020 04:48:03 GMT) Full text and rfc822 format available.

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

This bug report was last modified 2 years and 222 days ago.

Previous Next


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