Date: Thu, 15 Sep 2011 01:42:49 GMT From: "Wojciech A. Koszek" <wkoszek@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: bin/160745: sed(1) appends '\n' at the end of binary data (unlike gsed(1)) Message-ID: <201109150142.p8F1gnxA085340@red.freebsd.org> Resent-Message-ID: <201109150150.p8F1o6Sr049631@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 160745 >Category: bin >Synopsis: sed(1) appends '\n' at the end of binary data (unlike gsed(1)) >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 15 01:50:05 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Wojciech A. Koszek >Release: 8.2-STABLE >Organization: FreeBSD Project >Environment: FreeBSD 8.2-STABLE FreeBSD 8.2-STABLE #0: Tue Sep 13 21:31:11 CET 2011 root@:/usr/src/sys/i386/compile/GENERIC i386 >Description: File has ASCII data followed by binary data. ASCII data contains lines. Binary data contains 0's and follows. I use sed(1) to delete lines and present me the rest of the content in untouched form. In other words: I want to get binary data streamed throught sed(1) without modification. Currently sed(1) appends '\n' at the end of such data. gsed(1) works as expected. While gsed(1) just pipes binary data without a problem, we pipe data, but append '\n' at the end. >How-To-Repeat: Install ports/textproc/gsed for comparison. Run: http://freebsd.czest.pl/~wkoszek/stuff/freebsd/sed_problem.sh Script below. #!/bin/sh echo 1 > data echo 2 >> data echo 3 >> data dd if=/dev/zero bs=1m count=1 >> data echo "========== WE =========" cat data | sed '1,3 d' | hexdump -c | tail -5 echo "========== GNU ========" cat data | gsed '1,3 d' | hexdump -c | tail -5 >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201109150142.p8F1gnxA085340>