Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2018 12:05:19 -0500
From:      Pedro Giffuni <pfg@FreeBSD.org>
To:        Alan Somers <asomers@freebsd.org>
Cc:        src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r337419 - head/usr.bin/sed
Message-ID:  <0df14e6a-ccaf-d55f-d7cf-d95a243cf8c8@FreeBSD.org>
In-Reply-To: <CAOtMX2gUgDnA0G3qkWAV-R%2BSMb0bJu=d-odhXpQ7tuEiVKmRXw@mail.gmail.com>
References:  <201808071447.w77Eld3I069906@repo.freebsd.org> <CAOtMX2gUgDnA0G3qkWAV-R%2BSMb0bJu=d-odhXpQ7tuEiVKmRXw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On 8/16/2018 10:30 AM, Alan Somers wrote:
> On Tue, Aug 7, 2018 at 8:47 AM, Pedro F. Giffuni <pfg@freebsd.org 
> <mailto:pfg@freebsd.org>> wrote:
>
>     Author: pfg
>     Date: Tue Aug  7 14:47:39 2018
>     New Revision: 337419
>     URL: https://svnweb.freebsd.org/changeset/base/337419
>     <https://svnweb.freebsd.org/changeset/base/337419>;
>
>     Log:
>       sed(1): partial fix for the case of the regex delimited with '['.
>
>       We don't generally support the weird case of regular expresions
>     delimited
>       by an opening square bracket ('[') but POSIX says that inside
>       bracket expressions, escaping is not possible and both '[' and '\'
>       represent themselves.
>
>       PR:           230198 (exp-run)
>       Obtained from:        OpenBSD
>
>     Modified:
>       head/usr.bin/sed/compile.c
>
>     Modified: head/usr.bin/sed/compile.c
>     ==============================================================================
>     --- head/usr.bin/sed/compile.c  Tue Aug  7 14:39:00 2018       
>     (r337418)
>     +++ head/usr.bin/sed/compile.c  Tue Aug  7 14:47:39 2018       
>     (r337419)
>     @@ -393,11 +393,11 @@ compile_delimited(char *p, char *d, int is_tr)
>                             if ((d = compile_ccl(&p, d)) == NULL)
>                                     errx(1, "%lu: %s: unbalanced
>     brackets ([])", linenum, fname);
>                             continue;
>     +               } else if (*p == '\\' && p[1] == c) {
>     +                       p++;
>                     } else if (*p == '\\' && p[1] == '[') {
>                             *d++ = *p++;
>     -               } else if (*p == '\\' && p[1] == c)
>     -                       p++;
>     -               else if (*p == '\\' && p[1] == 'n') {
>     +               } else if (*p == '\\' && p[1] == 'n') {
>                             *d++ = '\n';
>                             p += 2;
>                             continue;
>
>
> This change seems to have caused a regression in multi_test.sh.
> https://ci.freebsd.org/job/FreeBSD-head-amd64-test/8630/testReport/usr.bin.sed/multi_test/main/

____

Seeding /usr/tests/usr.bin/sed/regress.multitest.out/2.23 with current 
result
sed: 1: "s[\[.[X[
": RE error: brackets ([ ]) not balanced
sed: 1: "s[\[.[X\[[
": RE error: brackets ([ ]) not balanced

____

Thanks for the report. The change is correct but incomplete, we also 
have to fix the first bug reported here:

http://undeadly.org/cgi?action=article;sid=20180728110010

I honestly don't have time for this so I'll revert the bug for the 
second fix for now.

Pedro.






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0df14e6a-ccaf-d55f-d7cf-d95a243cf8c8>