NetBSD Problem Report #42261

From www@NetBSD.org  Tue Nov  3 21:09:52 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 47B1C63C3FB
	for <gnats-bugs@gnats.netbsd.org>; Tue,  3 Nov 2009 21:09:52 +0000 (UTC)
Message-Id: <20091103210952.191FE63BA3B@www.NetBSD.org>
Date: Tue,  3 Nov 2009 21:09:52 +0000 (UTC)
From: tnn@NetBSD.org
Reply-To: tnn@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: sed(1) command parser bug with long lines
X-Send-Pr-Version: www-1.0

>Number:         42261
>Category:       bin
>Synopsis:       sed(1) command parser bug with long lines
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 03 21:10:00 +0000 2009
>Closed-Date:    Sat Dec 19 02:41:24 +0000 2015
>Last-Modified:  Sat Dec 19 02:41:24 +0000 2015
>Originator:     Tobias Nygren
>Release:        
>Organization:
>Environment:
NetBSD mac.tnn.office 5.99.21 NetBSD 5.99.21 (GENERIC.mac) #7: Thu Oct 22 10:51:26 CEST 2009  tnn@mac.tnn.office:/work/obj/sys/arch/amd64/compile/GENERIC.mac amd64
>Description:
the sed(1) command parser seems to break on s/foo/bar/g commands that are exactly 2049 bytes long (coincidentally _POSIX2_LINE_MAX + 1)

>How-To-Repeat:
The following shell script should output ${LONG_STR}, a string of 2043 x'es, but doesn't output anything. The "g" flag to the "s" command is treated as a new command.

#! /bin/sh
LONG_STR=$(awk 'BEGIN {while(x<2043){printf "x";x++}}')
echo x | sed s,x,${LONG_STR},g

>Fix:
Probably an off-by-one bug.
Needs to be pulled up to netbsd-5 when fixed.

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: bin-bug-people->tnn
Responsible-Changed-By: tnn@NetBSD.org
Responsible-Changed-When: Wed, 04 Nov 2009 09:30:11 +0000
Responsible-Changed-Why:
OpenBSD fixed the problem last year,
I'll merge their fix.



From: Tobias Nygren <tnn@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42261 CVS commit: src/usr.bin/sed
Date: Fri, 19 Feb 2010 16:35:27 +0000

 Module Name:	src
 Committed By:	tnn
 Date:		Fri Feb 19 16:35:27 UTC 2010

 Modified Files:
 	src/usr.bin/sed: compile.c defs.h extern.h main.c misc.c

 Log Message:
 Merge the following revisions from OpenBSD to let sed(1) handle
 arbitrarily long lines (closes our PR bin/42261).
 openbsd/usr.bin/sed/extern.h 1.5
 openbsd/usr.bin/sed/main.c 1.13-1.15
 openbsd/usr.bin/sed/misc.c 1.8
 openbsd/usr.bin/sed/compile.c 1.25-1.28
 openbsd/usr.bin/sed/defs.h 1.4


 To generate a diff of this commit:
 cvs rdiff -u -r1.36 -r1.37 src/usr.bin/sed/compile.c
 cvs rdiff -u -r1.9 -r1.10 src/usr.bin/sed/defs.h
 cvs rdiff -u -r1.10 -r1.11 src/usr.bin/sed/extern.h src/usr.bin/sed/misc.c
 cvs rdiff -u -r1.20 -r1.21 src/usr.bin/sed/main.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->suspended
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Mon, 22 Feb 2010 16:22:53 +0000
State-Changed-Why:
Let the fix germinate on HEAD for a while.
Should be pulled up eventually.


State-Changed-From-To: suspended->pending-pullups
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Mon, 22 Feb 2010 16:43:56 +0000
State-Changed-Why:
releng suggests pending-pullups be used for fixes that
should be pulled up. Make it so.


From: "Jukka Ruohonen" <jruoho@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/42261 CVS commit: src/tests/usr.bin/sed
Date: Mon, 19 Mar 2012 06:21:53 +0000

 Module Name:	src
 Committed By:	jruoho
 Date:		Mon Mar 19 06:21:53 UTC 2012

 Modified Files:
 	src/tests/usr.bin/sed: t_sed.sh

 Log Message:
 Add a case also for (fixed) PR bin/42261.


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/sed/t_sed.sh

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: pending-pullups->open
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 19 Mar 2012 10:34:04 +0000
State-Changed-Why:
pending-pullups is for pullups that have already been filed.


Responsible-Changed-From-To: tnn->bin-bug-people
Responsible-Changed-By: wiz@NetBSD.org
Responsible-Changed-When: Fri, 01 Feb 2013 22:46:29 +0000
Responsible-Changed-Why:
Back to role account.


State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sat, 19 Dec 2015 02:41:24 +0000
State-Changed-Why:
-5 is now EOL


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.