bzip2 --version or bzip2 --license (same thing) do not exit after
displaying version/license text as most utilities usually do, and
expects data to compress on stdin as if bzip2 was called without
arguments.
This leads to several problems in usage, such as:
Bogus error message when looking at version:
% bzip2 --version bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010. Copyright (C) 1996-2010 by Julian Seward. This program is free software; you can redistribute it and/or modify it under the terms set out in the LICENSE file, which is included in the bzip2-1.0.6 source distribution. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the LICENSE file for more details. bzip2: I won't write compressed data to a terminal. bzip2: For help, type: `bzip2 --help'.
Problems when examining this data, e.g. in scripts:
% bzip2 --version 2>&1 | head -1 bzip2, a block-sorting file compressor. Version 1.0.6, 6-Sept-2010. <hangs waiting for data>
So, let's make bzip2 exit right after it displays version/license information.
I've tried to contacted bzip2 author for a long time, but he's unresponsive.
For instance, Ubuntu has this problem fixed.
Related PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199443