From owner-freebsd-bugs@FreeBSD.ORG Thu Sep 15 01:50:06 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 92C6A1065673 for ; Thu, 15 Sep 2011 01:50:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4BD058FC19 for ; Thu, 15 Sep 2011 01:50:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p8F1o6lE049632 for ; Thu, 15 Sep 2011 01:50:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p8F1o6Sr049631; Thu, 15 Sep 2011 01:50:06 GMT (envelope-from gnats) Resent-Date: Thu, 15 Sep 2011 01:50:06 GMT Resent-Message-Id: <201109150150.p8F1o6Sr049631@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, "Wojciech A. Koszek" Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6529B106566C for ; Thu, 15 Sep 2011 01:42:49 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 540668FC17 for ; Thu, 15 Sep 2011 01:42:49 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p8F1gn7h085349 for ; Thu, 15 Sep 2011 01:42:49 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p8F1gnxA085340; Thu, 15 Sep 2011 01:42:49 GMT (envelope-from nobody) Message-Id: <201109150142.p8F1gnxA085340@red.freebsd.org> Date: Thu, 15 Sep 2011 01:42:49 GMT From: "Wojciech A. Koszek" To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: bin/160745: sed(1) appends '\n' at the end of binary data (unlike gsed(1)) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 01:50:06 -0000 >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: