need to handle BrokenPipeError gracefully
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
simplestreams |
Confirmed
|
Medium
|
Unassigned | ||
simplestreams (Ubuntu) |
Fix Released
|
Medium
|
Unassigned |
Bug Description
$ ./tools/
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
com.ubuntu.
Traceback (most recent call last):
File "/usr/bin/
main()
File "/usr/bin/
tmirror.
File "/usr/lib/
return self.sync_
File "/usr/lib/
self.
File "/usr/lib/
ret = self.call_
File "/usr/lib/
capture=
File "/usr/lib/
return run_command(
File "/usr/lib/
raise subprocess.
subprocess.
Exception BrokenPipeError: BrokenPipeError(32, 'Broken pipe') in <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'> ignored
Example of 'cat'
$ cat /dev/zero | head -c 1 ; echo ${PIPESTATUS[@]}
141 0
ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: simplestreams 0.1.0~bzr272-
ProcVersionSign
Uname: Linux 3.10.0-5-generic x86_64
ApportVersion: 2.11-0ubuntu1
Architecture: amd64
Date: Fri Aug 2 10:19:56 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2011-10-19 (653 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MarkForUpload: True
PackageArchitec
SourcePackage: simplestreams
UpgradeStatus: Upgraded to saucy on 2013-05-20 (74 days ago)
Originally, I had: 0:0:root: /root:/ bin/bash
$ cat /etc/passwd | head -n 1
root:x:
$ echo ${PIPESTATUS[@]}
0 0
Ie, 'cat' exits success.
That is actually not true. that specific example of 'cat' would never get a broken pipe signal as it would read all of /etc/passwd, write all of /etc/passwd , head would read into buf, split lines, exit.
Better example:
$ cat /dev/zero | head -c 1 ; echo ${PIPESTATUS[@]}
141 0
Note that 141-128=13 and SIGPIPE==13