Subject: bin/2331: tar doesn't read all of stdin
To: None <gnats-bugs@NetBSD.ORG>
From: Greg Hudson <ghudson@mit.edu>
List: netbsd-bugs
Date: 04/14/1996 17:07:56
>Number:         2331
>Category:       bin
>Synopsis:       tar doesn't read all of stdin
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 14 17:35:04 1996
>Last-Modified:
>Originator:     Greg Hudson
>Organization:
	MIT SIPB
>Release:        1.1
>Environment:
System: NetBSD glacier 1.1 NetBSD 1.1 (GLACIER) #0: Sun Jan 14 06:01:22 EST 1996 ghudson@glacier:/usr/var/tmp/build/src/sys/arch/i386/compile/GLACIER i386

>Description:
	tar closes stdin (or the input from the child gzip process, when
	using -z) without reading all of it.  Since ustar files can
	include extra padding at the end, it may not read all of a valid
	tar file.  This means the process writing its standard input can
	get a SIGPIPE.

	This bit me when doing an ftp "get" piped to gzip -cd piped to
	tar in an installation script.

>How-To-Repeat:
	dd if=file.tar bs=512 | tar tf -

	You'll notice no output from dd at the end; this is because it got
	a SIGPIPE.  If you ktrace it:

	ktrace -i /bin/sh -c "dd if=file.tar bs=512 | tar tf -"

	then you'll be able to see the SIGPIPE.

>Fix:
>Audit-Trail:
>Unformatted: