bzip2 does not exit after showing license as requested with --version
authoramdmi3 <amdmi3@FreeBSD.org>
Wed, 28 Dec 2016 18:04:18 +0000 (18:04 +0000)
committeramdmi3 <amdmi3@FreeBSD.org>
Wed, 28 Dec 2016 18:04:18 +0000 (18:04 +0000)
commitde0705f5c53487ad4b128d64e6aae11b202aee2c
treedb986ac3f9ee238858d1bee43d7b209d233c43e9
parentcf397d6e0f19fa563c921fca421ab27114731061
bzip2 does not exit after showing license as requested with --version
or --license as most apps would do, instead it waits for data to
compress on stdin. Because of that, if `bzip2 --version' is called,
bogus `bzip2: I won't write compressed data to a terminal' error
message will be displayed, and checking for bzip2 version in scripts
as in

    bzip2 --version 2>&1 | grep -o "Version [^,]*"

will hand as bzip2 would wait for data to compress on stdin. Fix
this by exiting right after showing version/license text.

I've tried to push this upstream for more than a year, but author
is unresponsive, so upstream may be considered dead.

Ubuntu applies similar fix, for the note.

PR: 199443
Approved by: dim, bapt
MFC after: 2 weeks
Differential Revision: D8924
contrib/bzip2/bzip2.c