Subject: pkg/33780: nbsed on solaris, more bugs
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <Lloyd.Parkes@ird.govt.nz>
List: pkgsrc-bugs
Date: 06/21/2006 03:05:00
>Number:         33780
>Category:       pkg
>Synopsis:       nbsed on solaris, more bugs
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 21 03:05:00 +0000 2006
>Originator:     Lloyd Parkes
>Release:        Solaris 9
>Organization:
Inland Revenue
>Environment:
SunOS XXX.ird.govt.nz 5.9 Generic sun4u sparc SUNW,UltraAX-i2
bash-2.05$ grep RCSID *.c
compile.c:__RCSID("$NetBSD: compile.c,v 1.7 2005/11/30 21:07:14 schwarz Exp $");
main.c:__RCSID("$NetBSD: main.c,v 1.5 2004/08/21 08:39:54 jlam Exp $");
misc.c:__RCSID("$NetBSD: misc.c,v 1.3 2004/08/21 08:39:54 jlam Exp $");
process.c:__RCSID("$NetBSD: process.c,v 1.8 2004/08/22 05:51:55 jlam Exp $");

>Description:
textproc/nbsed prints random garbage if the last line in the file is not terminated with \n.

>How-To-Repeat:
bash-2.05$ echo -n foo > bar
bash-2.05$ nbsed /baz/d bar| od -c
0000000   f   o   o  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
0000020  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0001020  \0 002 304 300  \0  \0  \0  \0  \0  \0  \0 003  \0  \0  \0  \0
0001040  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0  \0
*
0001777
bash-2.05$ sed /baz/d bar| od -c
0000000
bash-2.05$ 
bash-2.05$ od -c bar
0000000   f   o   o
0000003
bash-2.05$ gsed /baz/d bar| od -c
0000000   f   o   o
0000003

Gratuitous comparison with the almost as broken Solaris sed is at the end here.
>Fix:
I don't have time to look at the source, but had a go at p the following in mk.conf as a workaround

        TOOLS_PLATFORM.sed=/opt/IROS/bin/gsed