[iostreams] bzip2 filter fails with large file on Xen system
Hello, I've tried the example at http://www.boost.org/doc/libs/1_42_0/libs/iostreams/doc/index.html It works correctly on small files (a few kb), but it raises the exception "bzip2 error" on a file as large as ~270Mb, when compiled with g++ 4.2, with no special flags, on a 64 bit Linux Xen system. On another system (Mac OS X), the example runs fine on that same file. Here is some info about the system: Linux kernel: 2.6.24-26-xen bzlib2: 1.0.4-2ubuntu4 Boost: 1.42.0 Are there known incompatibilities with that system or with virtualization environments in general? Is there any "self-test" that I can run to test the library? Nicola
On 3/22/2010 10:29 AM, Nicola wrote: ...
Is there any "self-test" that I can run to test the library?
All the libraries have a set of unit tests which can be run. It may or may not exercise the specific issue you are seeing, but... For info on how to run them for a given library, see: http://archives.free.net.ph/message/20070831.015329.594803cf.el.html
In article <4BA92A12.8030708@gmail.com>, eg
http://archives.free.net.ph/message/20070831.015329.594803cf.el.html
Thanks for the link. All iostreams tests pass. But the tests use streams of small size, as far as I can see, so I think that they don't cover my issue. Nicola
On 3/24/2010 6:42 AM, Nicola wrote:
In article<4BA92A12.8030708@gmail.com>, eg
wrote: http://archives.free.net.ph/message/20070831.015329.594803cf.el.html
Thanks for the link. All iostreams tests pass. But the tests use streams of small size, as far as I can see, so I think that they don't cover my issue.
Can you post your test program? I can try to run it on a Windows box to see if I can reproduce it.
In article <4BAA33F4.4020406@gmail.com>, eg
On 3/24/2010 6:42 AM, Nicola wrote:
In article<4BA92A12.8030708@gmail.com>, eg
wrote: http://archives.free.net.ph/message/20070831.015329.594803cf.el.html
Thanks for the link. All iostreams tests pass. But the tests use streams of small size, as far as I can see, so I think that they don't cover my issue.
Can you post your test program? I can try to run it on a Windows box to see if I can reproduce it.
As I've said, it's essentially the example from the Iostreams doc page:
#include <fstream>
#include <iostream>
#include
On 3/24/2010 3:19 PM, Nicola wrote:
As I've said, it's essentially the example from the Iostreams doc page:
Well there are a few, so thanks for posting the specific one.
#include<fstream> #include<iostream> #include
#include #include int main(int argc, char * const argv[]) { using namespace std; using namespace boost::iostreams;
ifstream file(argv[1], ios_base::in | ios_base::binary); filtering_streambuf<input> in; in.push(bzip2_decompressor()); in.push(file); try { boost::iostreams::copy(in, cout); } catch (std::exception& e) { std::cout<< "EXCEPTION CAUGHT: "<< e.what()<< std::endl; } return 0; }
The output of the above program is
EXCEPTION CAUGHT: bzip2 error
when the argument is a “big” bzipped file (~270Mb).
I tried the above on WinXP with a big bzipped file (~315 Mb) and it worked without error. The only change I made was to copy it to an ofstream instead of cout (to prevent incessant beeping on my machine). hmmm.
The program I'm developing also fails to read the compressed file, but without errors: it just doesn't read anything. The following is a minimal self-contained excerpt that exhibits such behaviour:
I wonder if this is related to the reported problem: https://svn.boost.org/trac/boost/ticket/2411
eg wrote:
The program I'm developing also fails to read the compressed file, but without errors: it just doesn't read anything. The following is a minimal self-contained excerpt that exhibits such behaviour:
I wonder if this is related to the reported problem:
It might well be. There are several reported problems with Boost.IoStreams and compression filters. Unfortunately there are different problems for different filter/compressor/decompressor combinations. See the following link for last year's summary. The attachment shows the code that works for me. Regards, Roland
I have to apologize. It turns out that I was working with a symlink to a file in a shared directory, and another user had bunzipped those files, keeping the same name (to start with, the compressed files didn't have a .bz2 suffix - don't ask me why). The copy in my laptop was made before that happened, so there all was fine. Cherry on the cake: recently I was viewing the files with bzless instead of bzcat - which, I've now realized, behaves like less if the file is plain text. Well, that's embarassing (and somewhat irritating, as I've spent a bunch of hours trying to figure out what was going on). Thanks for trying to help. I'll do my best to avoid posting noise again. Nicola
Nicola wrote:
I have to apologize. It turns out that I was working with a symlink to a file in a shared directory, and another user had bunzipped those files, keeping the same name (to start with, the compressed files didn't have a .bz2 suffix - don't ask me why). The copy in my laptop was made before that happened, so there all was fine. Cherry on the cake: recently I was viewing the files with bzless instead of bzcat - which, I've now realized, behaves like less if the file is plain text.
Well, that's embarassing (and somewhat irritating, as I've spent a bunch of hours trying to figure out what was going on).
Thanks for trying to help. I'll do my best to avoid posting noise again.
Nicola
Thanks for the notice. Don't be embarrassed. This kind of stuff happens to everybody every once in a while :-)
participants (3)
-
eg
-
Nicola
-
Roland Bock