
I have a function that uses a chain of filters that I am using to read encrypted, bzipped data from file. It is working fine. However, I have just discovered that if I call my function with a file that does not exist, the code hangs in the constructor for xml_iarchive. Of course, I have since edited my code to trap non-existent files before the code gets that far, but I am surprised that: * is_complete() returns true when the source is a non-existent file * the constructor for xml_iarchive hangs when it is given a stream that has a non-existent file as its source Is this correct behaviour or a bug? Of course, it is the programmer's responsibility to ensure the source exists, but a hang rather than an exception seems suggests to me that something has been overlooked in the library. The (edited) function exhibiting this behaviour is given below. I am using gcc 3.2.3 and Boost 1.33.1. Paul void load(const std::string& filename) { //my revised tests "filename" here and bails out if the file does not exist try { boost::iostreams::filtering_istream in; in.push(boost::iostreams::bzip2_decompressor()); in.push(MyInputEncryptionFilter()); in.push(boost::iostreams::bzip2_decompressor()); in.push(boost::iostreams::file_source(filename, BOOST_IOS::in | BOOST_IOS::binary)); if (!in.is_complete()) { std::cerr << "Error creating filtering input stream" << std::endl; return; } boost::archive::xml_iarchive input_archive(in); //deserialise file here return; } //various catches removed }