Subject: [Boost-bugs] [Boost C++ Libraries] #5237: filtering_ostream produce incorrect empty files with gzip_compressor and other filters
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-02-27 11:07:17
#5237: filtering_ostream produce incorrect empty files with gzip_compressor and
other filters
----------------------------------+-----------------------------------------
Reporter: come.raczy@⦠| Owner: turkanis
Type: Bugs | Status: new
Milestone: To Be Determined | Component: iostreams
Version: Boost 1.44.0 | Severity: Problem
Keywords: |
----------------------------------+-----------------------------------------
The attached program should produce an empty gzip file, using the
gzip_compressor:
{{{
int main()
{
using namespace boost::iostreams;
filtering_ostream os;
os.push(boost::iostreams::gzip_compressor());
os.push(boost::iostreams::file_sink("emptyGzipBug.txt.gz"));
}
}}}
The resulting file is not a gzip file:
{{{
$ hexdump emptyGzipBug.txt.gz
0000000 0003
0000002
$ zcat testGzipEmpty.txt.gz
zcat: testGzipEmpty.txt.gz: not in gzip format
$
}}}
A workaround is to manually force an empty write into the stack of
components with something like this:
{{{
char dummy = 'b';
os.component<gzip_compressor>(0)->write(*os.component<file_sink>(1),
&dummy, 0);
}}}
The problem seems to affect all versions, including Boost 1.46.0
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/5237> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:05 UTC