Date: Fri, 27 Oct 2000 09:46:33 -0700 (PDT) From: stefan.duerholt@t-online.de To: freebsd-gnats-submit@FreeBSD.org Subject: bin/22351: sed(1) fails with backslash on buffer boundary in subst expressions Message-ID: <20001027164633.AC82F37B479@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 22351
>Category: bin
>Synopsis: sed(1) fails with backslash on buffer boundary in subst expressions
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Oct 27 09:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Stefan Duerholt
>Release: 3.5-RELEASE, 4.0-RELEASE
>Organization:
>Environment:
Different versions of FreeBSD (3.5-RELEASE, 4.0-RELEASE), also
CVS checked out from -CURRENT
>Description:
In an substitution command like
$ sed -e "s/X/xxxx ... xxxx\\zz/",
where the first '\' is exacly on character position 2048 (i.e.
exactly 2043 'x' in this example), sed fails to compile the
substitution expression and aborts with
sed: 1: "s/X/xxxxxxxxxxxxxxxxxxx ...": \ not defined in the RE
The same with -f and a file containing the line.
Also with multiple of 2048.
This causes (for example) ruby-1.6.1 to fail during make, as autoconf
generates substitution expressions with such long lines.
>How-To-Repeat:
if you type:
$ sed -e `perl -le 'print "s/X/","x"x2043,"\\\\zz/"'`
it fails with:
sed: 1: "s/X/xxxxxxxxxxxxxxxxxxx ...": \ not defined in the RE
>Fix:
Apply this patch to src/usr.bin/sed/compile.c
"$FreeBSD: src/usr.bin/sed/compile.c,v 1.14 2000/03/19 19:41:52 green Exp $"
--- compile.c.orig Sun Mar 19 19:41:52 2000
+++ compile.c Fri Oct 27 16:10:39 2000
@@ -471,13 +471,16 @@
op = sp = text + size;
for (; *p; p++) {
if (*p == '\\') {
- p++;
+ if (*++p == '\0') {
+ if (cu_fgets(lbuf, sizeof(lbuf), &more))
+ p = lbuf;
+ }
if (strchr("123456789", *p) != NULL) {
*sp++ = '\\';
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001027164633.AC82F37B479>
