Comment 14 for bug 961611

Revision history for this message
David Ayers (ayers) wrote :

I know next to nothing about C++ but I believe this is a symptom of a programming error in apt:

The code in
apt-pkg/sourcelist.cc

says:
   ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
   if (!F != 0)
      return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());

but the C++ documentation I found says:
If the constructor is not successful in opening the file, the object is still created although no file is associated to the stream buffer and the stream's failbit is set (which can be checked with inherited member fail).
http://www.cplusplus.com/reference/iostream/ifstream/ifstream/

So I believe that the the if case is arbitrarily failing due to type promotion rules dependent on the address that is stored in F.

That would make this a bug in the apt package which is repeated a few times in other places.