Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 May 2000 16:43:38 -0700 (PDT)
From:      nsayer@freebsd.org
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/18474: sed i does not append newline
Message-ID:  <200005092343.QAA46021@yoda.sftw.com>

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

>Number:         18474
>Category:       bin
>Synopsis:       sed i\ does not append newline
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 09 16:50:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Nick Sayer
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
Just me
>Environment:

Shell script bar:

#! /bin/sh

sed -e '3i\
foo' < foo

and foo contains:

1
2
3
4
5

>Description:

On FreeBSD, the output of script 'bar' is

1
2
foo3
4
5

On every other OS I have tried, the output is

1
2
foo
3
4
5

>How-To-Repeat:

See above.

>Fix:


--- usr.bin/sed/process.c.orig	Tue May  9 16:42:30 2000
+++ usr.bin/sed/process.c	Tue May  9 16:42:39 2000
@@ -157,7 +157,7 @@
 				cspace(&HS, ps, psl, 0);
 				break;
 			case 'i':
-				(void)printf("%s", cp->t);
+				(void)printf("%s\n", cp->t);
 				break;
 			case 'l':
 				lputs(ps);

>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?200005092343.QAA46021>