Bug 38195 - sed(1)'s process.c does not correctly append lines of input.
Summary: sed(1)'s process.c does not correctly append lines of input.
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: standards (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: Tim Robbins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-17 18:50 UTC by Juli Mallett
Modified: 2002-07-03 15:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Juli Mallett freebsd_committer 2002-05-17 18:50:01 UTC
FreeBSD's sed(1) is incompatible with its handling of the G and H commands because it does not explicitly append newlines when appending a line of input, it relies on them just "popping up" because we use fgetln to get lines of input.  This relates to appending the hold or pattern space.

Fix: 

Create a function to append a line to a given space, instead of using cspace, and have it do the correct thing.  Possibly, NUL-terminate at the newline when using fgetln(3) at mf_gets.
How-To-Repeat: (echo 1; echo 2; echo 3; echo 4) | sed '1,2H;2,3G'

with our sed(1), and GNU's, and SysV's.
Comment 1 Tim Robbins freebsd_committer 2002-06-22 02:48:21 UTC
State Changed
From-To: open->patched

Fix committed to -CURRENT, I will MFC it after 4 weeks (sed is quite a 
fragile beast). 


Comment 2 Tim Robbins freebsd_committer 2002-06-22 02:48:21 UTC
Responsible Changed
From-To: freebsd-standards->tjr

Fix committed to -CURRENT, I will MFC it after 4 weeks (sed is quite a 
fragile beast).
Comment 3 Tim Robbins freebsd_committer 2002-07-03 15:56:12 UTC
State Changed
From-To: patched->closed

Somebody else beat me to the MFC.