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

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: sed; Reported by: Enrico Maria De Angelis <enricomaria.dean6elis@HIDDEN>; Keywords: confirmed; merged with #40242; dated Thu, 26 Mar 2020 15:30:01 UTC; Maintainer for sed is bug-sed@HIDDEN.
Added tag(s) confirmed. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Merged 40239 40242. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 40239 <at> debbugs.gnu.org:


Received: (at 40239) by debbugs.gnu.org; 31 Mar 2020 04:47:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 31 00:47:12 2020
Received: from localhost ([127.0.0.1]:35383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jJ8nw-0001pN-5Y
	for submit <at> debbugs.gnu.org; Tue, 31 Mar 2020 00:47:12 -0400
Received: from mail-pj1-f41.google.com ([209.85.216.41]:36435)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <assafgordon@HIDDEN>)
 id 1jJ8nu-0001p3-3i; Tue, 31 Mar 2020 00:47:10 -0400
Received: by mail-pj1-f41.google.com with SMTP id nu11so561999pjb.1;
 Mon, 30 Mar 2020 21:47:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=subject:to:references:from:message-id:date:user-agent:mime-version
 :in-reply-to:content-language:content-transfer-encoding;
 bh=ojJ9QCLFwHOSpAcOAyLAEFVjmhrnpR+EFgnq2epfkF4=;
 b=XnMVrj1N0JdlZYHuEGtOJnH0P/MyWkXWVbiikEEI7voiS0OVIWvGp7Q4gqbnChoCas
 XAbRFsAXj1dhYhAJK3ayZT1LYcr1+koomyV8ZUEBTglism6n5rQTI7A5Qo8VkaGuUCou
 SLgIwXsd8DhyZfjZZhuExot5YFFHbPt0JWotqHQ2A5TsXXJfJtml8T6l0HEcMt5jsPQ4
 WJsppR11IwO1oP6/oOgxMHKy6zzCOuo4RiqIdM3VcrOiRJgLDNcgi7lJNzPYTRYHQpjK
 Dr49TAIl66gNOzujinM7RIi2uhRtUeGV62Xjxr6IV++868/Jv0/I4feUq0oZ4S3iZYPS
 laGw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:subject:to:references:from:message-id:date
 :user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=ojJ9QCLFwHOSpAcOAyLAEFVjmhrnpR+EFgnq2epfkF4=;
 b=AGIcnQIbel2QZemOfgCN2gV17mPmKXuLLzsGJeyomtQ/UJ8s899fCTv+xMSXyirBPN
 1N1ojwbv2dGwBOF3nuFUNmsRi3smfoxKdHpC1ydGC41rmrkM5U5LyC2QnMplfbMMjrdH
 0qlI76LM22cD9E9fdC54A7ZFLZ5TNrGUN2pwTO3GbQBDtkgJqSqjURcjN9yAf77ec67h
 BMrDrUOtE9tTSbw5u46fkszykHDHzzEr+3dbNJseDcqRW5iC/xsmUteC1BvKQTeFYwcW
 kkLuoclQvRrRjLBnALSaEsuQM4rLUqNR0gee6OMbIZN8tCOgdb06OHlKbEbeBUyI51ds
 4+jQ==
X-Gm-Message-State: AGi0PuYjAZtNab59g3RQhCXlg0mSgsMGV/Brx7axdpMgrzqq9K+dxvD3
 Yu8tkCt50bGc6v3LGE/WkNPqLYF2
X-Google-Smtp-Source: APiQypK4DBGx/9t588UpwRpMTMICv5So2EJwMUKCLTK8Bc/c+V6JdCAa7zp8eePcP5jEWZQqcLQ3pA==
X-Received: by 2002:a17:90a:cb18:: with SMTP id
 z24mr1678868pjt.67.1585630023642; 
 Mon, 30 Mar 2020 21:47:03 -0700 (PDT)
Received: from tomato.moose.housegordon.com (moose.housegordon.com.
 [184.68.105.38]) by smtp.googlemail.com with ESMTPSA id
 t186sm10659038pgd.43.2020.03.30.21.47.02
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 30 Mar 2020 21:47:02 -0700 (PDT)
Subject: Re: bug#40239: Bug in how \cregexpc is handled
To: Enrico Maria De Angelis <enricomaria.dean6elis@HIDDEN>,
 40239 <at> debbugs.gnu.org
References: <CAO_nHykcJj8yBCOJ+s4gWBfbWBkHz2jnyGWeVN=4+k0ss-zxWQ@HIDDEN>
From: Assaf Gordon <assafgordon@HIDDEN>
Message-ID: <f8e182b0-c674-50e6-0209-08c84c7318b2@HIDDEN>
Date: Mon, 30 Mar 2020 22:47:01 -0600
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.6.0
MIME-Version: 1.0
In-Reply-To: <CAO_nHykcJj8yBCOJ+s4gWBfbWBkHz2jnyGWeVN=4+k0ss-zxWQ@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 40239
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

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




Information forwarded to bug-sed@HIDDEN:
bug#40239; Package sed. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Mar 2020 15:29:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 26 11:29:43 2020
Received: from localhost ([127.0.0.1]:59503 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1jHURz-00073n-94
	for submit <at> debbugs.gnu.org; Thu, 26 Mar 2020 11:29:43 -0400
Received: from lists.gnu.org ([209.51.188.17]:34336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <enricomaria.dean6elis@HIDDEN>) id 1jHTLJ-00059l-9K
 for submit <at> debbugs.gnu.org; Thu, 26 Mar 2020 10:18:45 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35293)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <enricomaria.dean6elis@HIDDEN>) id 1jHTLH-0006K6-S8
 for bug-sed@HIDDEN; Thu, 26 Mar 2020 10:18:45 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 HTML_MESSAGE,URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <enricomaria.dean6elis@HIDDEN>) id 1jHTLG-0003Zx-NU
 for bug-sed@HIDDEN; Thu, 26 Mar 2020 10:18:43 -0400
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:36545)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <enricomaria.dean6elis@HIDDEN>)
 id 1jHTLG-0003Yo-C3
 for bug-sed@HIDDEN; Thu, 26 Mar 2020 10:18:42 -0400
Received: by mail-wm1-x32c.google.com with SMTP id g62so7221026wme.1
 for <bug-sed@HIDDEN>; Thu, 26 Mar 2020 07:18:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=5v4sFLDb/5r7/EC6Tr+BWuI2l7PBlGMPBcSxhm0CnCA=;
 b=Cx6lqNuxucSSFl0L882hLzsZ2cOGZDYZrn8BB7+hLR4YRN/lHUtpjuCZ4DaY+Ue5wr
 oujcuB8TTJi6zvhDUW5/MfwsN7sBzi3yoL+ss9O/Vv+6oAjlZ6Mj2eAeOINt+9LZQZEE
 qOH/VoB7Gfs2elHU2HT4BooP4QvSsgJsbwBGlV+1YWBI5qmvMnhlHNJkpGIqOPgizVDu
 U3ma2eJVWiXhBwgZ5uA3Dh3ivX6p335DTQRdT5+JbHTMgWZvgySAl5CJd7MZLj/Qaq7w
 W4NzBcfmIAxxy9zIv9FhXX2ofZ+t3VnnIVT/pN/v3H1dLhw8GRxLKbQIdXPup0pFt9HK
 VGqQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=5v4sFLDb/5r7/EC6Tr+BWuI2l7PBlGMPBcSxhm0CnCA=;
 b=YhlBp+nY+xO3f8nnw62naDMdeWoB1KGuW1Y4x8G+3XxZUuOg9QUoDcBwz9dzOpg1pz
 1GLsuIBMDBvenKTNdqCSjsNnCeOUY27tZO9iVa9MuiHJRojdLcLmLLMRgj+hmQTnMnRb
 kL6II2lC1SzKR3U8l89MXYIZBtCWJ1CRXRcM+UjNH+Vvo+J5sIZdBtC3Uyz7HTXzIU3t
 qHzfoYs1BiqvN8D02p1GEY3FEYsV/XHBky6UPn7kkIK31P6RgZXtZuPggSF658wcpu3g
 4RIS76sVVveDojRdG9GE429a9wAp9CpcScg6n5nmpHwo7wRs6Ib/9hl6gh9pdEC1mTbH
 tz9Q==
X-Gm-Message-State: ANhLgQ3TpM+mIU+8p/OECY0MyQ5LNwM6VRv6m7CzQkcqQpXH3SAqbLJh
 u5IB+bGFXuBiKMI6mBxpdlAfJWC0Et9cmHOm50f7BhOP
X-Google-Smtp-Source: ADFU+vvun/TxwVO/p5g3Tx8c9Iiixv36oyahg1iDHZ8cB+Mx5LXmVzc439+BmmIkjovSBhkfwDD94a+VED2AbYErGQ8=
X-Received: by 2002:a05:600c:54f:: with SMTP id
 k15mr200237wmc.76.1585232319781; 
 Thu, 26 Mar 2020 07:18:39 -0700 (PDT)
MIME-Version: 1.0
From: Enrico Maria De Angelis <enricomaria.dean6elis@HIDDEN>
Date: Thu, 26 Mar 2020 14:18:28 +0000
Message-ID: <CAO_nHykcJj8yBCOJ+s4gWBfbWBkHz2jnyGWeVN=4+k0ss-zxWQ@HIDDEN>
Subject: Bug in how \cregexpc is handled
To: bug-sed@HIDDEN
Content-Type: multipart/alternative; boundary="0000000000004ea02f05a1c2a9e8"
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::32c
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Thu, 26 Mar 2020 11:29:42 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

--0000000000004ea02f05a1c2a9e8
Content-Type: text/plain; charset="UTF-8"

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

--0000000000004ea02f05a1c2a9e8
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">To whom it may concern,<div><br></div><div>From <font face=
=3D"monospace">man sed</font>, I read:<div><font face=3D"monospace">=C2=A0 =
=C2=A0 =C2=A0 =C2=A0\cregexpc<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 Match lines matching the regular expression regexp.=C2=A0 The c may =
be any character.</font><br></div><div><font face=3D"arial, sans-serif">On =
the one hand</font></div><div><ul><li><font face=3D"monospace">sed &#39;\cn=
cd&#39; &lt;&lt;&lt; n</font><font face=3D"arial, sans-serif">=C2=A0correct=
ly shows empty output, since it&#39;s the same as=C2=A0</font><font face=3D=
"monospace">sed &#39;/n/d&#39; &lt;&lt;&lt; n</font> based on the descripti=
on above;</li><li><font face=3D"monospace">sed &#39;\c\ccd&#39; &lt;&lt;&lt=
; c</font> correctly shows an empty output too, but in this case the letter=
 needed to be escaped for obvious reasons.</li></ul>=C2=A0On the other hand=
:<ul><li><font face=3D"monospace">sed &#39;\n\nnd&#39; &lt;&lt;&lt; n</font=
> results in an output equal to the single character <font face=3D"monospac=
e">n</font>, revealing that the backslash is having a double effect:</li><o=
l><li>it prevents the following <font face=3D"monospace">n</font> from clos=
ing the opening <font face=3D"monospace">\n</font>.</li><li>it interprets t=
he <font face=3D"monospace">n</font> as a newline instead of the literal le=
tter <font face=3D"monospace">n</font>; this is confirmed by executing=C2=
=A0<font face=3D"monospace">echo -e &#39;a\na&#39; | sed -n &#39;N;\n\nnp&#=
39;</font>.</li></ol></ul>The is means that using <font face=3D"monospace">=
n</font> in <font face=3D"monospace">\nregexpn</font> prevevents=C2=A0the u=
se of the literal <font face=3D"monospace">n</font> in the <font face=3D"mo=
nospace">regexp</font>.<br></div><div><br></div><div>The issue has come to =
light in this <a href=3D"https://stackoverflow.com/questions/60853746/what-=
is-n-nnd-supposed-to-do">StackOverflow</a> question.</div><div><br></div><d=
iv>Kind regards,</div><div>Enrico Maria De Angelis</div></div></div>

--0000000000004ea02f05a1c2a9e8--




Acknowledgement sent to Enrico Maria De Angelis <enricomaria.dean6elis@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-sed@HIDDEN. Full text available.
Report forwarded to bug-sed@HIDDEN:
bug#40239; Package sed. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 31 Mar 2020 05:00:02 UTC

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