]> Cypherpunks repositories - gostls13.git/commit
archive/tar: fix race in TestNonSeekable
authorJoel Sing <jsing@google.com>
Wed, 25 Jan 2012 02:44:53 +0000 (13:44 +1100)
committerAndrew Gerrand <adg@golang.org>
Wed, 25 Jan 2012 02:44:53 +0000 (13:44 +1100)
commite3e1804ed2af1163335369300cfc562c35ffa4c9
treef8b44798a93794f62cd5cd33cec3bf95609db06b
parentdd442a556e5d9457caf318cd9b77e0a58041ab72
archive/tar: fix race in TestNonSeekable

Reimplement the test based on code from adg@golang.org.

The previous version has a race since the file is closed via defer
rather than in the go routine. This meant that the file could be
closed before the go routine has actually received io.EOF. It then
receives EBADF and continues to do zero-byte writes to the pipe.

This addresses an issue seen on FreeBSD and OpenBSD, where the test
passes but exits with a SIGPIPE, resulting in a failure.

R=golang-dev, adg
CC=golang-dev
https://golang.org/cl/5554083
src/pkg/archive/tar/reader_test.go