From owner-svn-src-head@freebsd.org Tue Dec 10 19:24:11 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 802BC1E27C6 for ; Tue, 10 Dec 2019 19:24:11 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47XVNq2qRjz48jg for ; Tue, 10 Dec 2019 19:24:11 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 4A0FE9E4C for ; Tue, 10 Dec 2019 19:24:11 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f169.google.com with SMTP id k6so17462076qki.5 for ; Tue, 10 Dec 2019 11:24:11 -0800 (PST) X-Gm-Message-State: APjAAAVLwUwjiTNNBAbRyWKVQU4lWh2xo1pgJ/QjaoL7wFOOGBQiAscp eU0sfi9e5wrPTiqb/IVpulpfYuS70pK1de0Fnr0= X-Received: by 2002:a37:4fd0:: with SMTP id d199mt33252985qkb.103.1576005850588; Tue, 10 Dec 2019 11:24:10 -0800 (PST) MIME-Version: 1.0 References: <201912101916.xBAJG0Lf080839@repo.freebsd.org> In-Reply-To: <201912101916.xBAJG0Lf080839@repo.freebsd.org> From: Kyle Evans Date: Tue, 10 Dec 2019 13:23:58 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r355590 - in head/usr.bin/sed: . tests tests/regress.multitest.out Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Dec 2019 19:24:11 -0000 On Tue, Dec 10, 2019 at 1:16 PM Kyle Evans wrote: > > Author: kevans > Date: Tue Dec 10 19:16:00 2019 > New Revision: 355590 > URL: https://svnweb.freebsd.org/changeset/base/355590 > > Log: > sed: process \r, \n, and \t > > This is both reasonable and a common GNUism that a lot of ported software > expects. > > Universally process \r, \n, and \t into carriage return, newline, and tab > respectively. Newline still doesn't function in contexts where it can't > (e.g. BRE), but we process it anyways rather than passing > UB \n (escaped ordinary) through to the underlying regex engine. > This part of the message is wrong -- it would pass just an ordinary 'n', rather than an escaped ordinary, and lead to potential false-positives if you think you're matching on an embedded newline but instead match on 'n'. Further, my reading of POSIX's statement on this leads me to believe that we have to treat it as a newline rather than embedding it as 'n' or escaped-'n' which regex(3) will certainly not interpret as a newline. > Adding a --posix flag to disable these was considered, but sed.1 already > declares this version of sed a super-set of POSIX specification and this > behavior is the most likely expected when one attempts to use one of these > escape sequences in pattern space. > > This differs from pre-r197362 behavior in that we now honor the three > arguably most common escape sequences used with sed(1) and we do so outside > of character classes, too. > > Other escape sequences, like \s and \S, will come later when GNU extensions > are added to libregex; sed will likely link against libregex by default, > since the GNU extensions tend to be fairly un-intrusive. > > PR: 229925 > Reviewed by: bapt, emaste, pfg > Differential Revision: https://reviews.freebsd.org/D22750 >