# A Python tarball extraction bug caused by pipe closure and SIGPIPE

DevFeed: [A Python tarball extraction bug caused by pipe closure and SIGPIPE](<https://devfeed.tech/articles/a-very-subtle-bug-21896.md>)

Original publisher: [Read original article](<https://blog.nelhage.com/2010/02/a-very-subtle-bug/>)

Author: Nelson Elhage

Published: 2010-02-27T23:48:47Z

Content type: article

Language: en

Sources: [Nelson Elhage](<https://devfeed.tech/sources/nelson-elhage.md>)

Topics: [bug](<https://devfeed.tech/topics/bug.md>), [Python](<https://devfeed.tech/topics/python.md>), [Processes](<https://devfeed.tech/topics/processes.md>), [Streams](<https://devfeed.tech/topics/streams.md>)

Tags: [bug](<https://devfeed.tech/tags/bug.md>), [code](<https://devfeed.tech/tags/code.md>), [process](<https://devfeed.tech/tags/process.md>), [python](<https://devfeed.tech/tags/python.md>), [signal](<https://devfeed.tech/tags/signal.md>)

## AI overview

The article explains a Python bug in extracting a single file from a tarball. The reader may close a pipe after finding the requested file while the decompression process is still writing, causing SIGPIPE and a resulting error because Python ignores SIGPIPE and checks write results instead.

## Source excerpt

6.033, MIT's class on computer systems, has as one of its catchphrases, "Complex systems fail for complex reasons". As a class about designing and building complex systems, it's a reminder that failure modes are subtle and often involve strange interactions between multiple parts of a system. In my own experience, I've concluded that they're often wrong. I like to say that complex systems don't usually fail for complex reasons, but for the simplest, dumbest possible reasons - there are just more available dumb reasons.