non-existent rpm-dir directory causes apt to dump core

Jeff Pitman <[email protected]> Fri, 17 Sep 2004 23:55:20 +0800
Newsgroups gmane.linux.conectiva.apt-rpm
Message-ID <[email protected]>
hi:

using apt-0.5.15cnc6-51 (rh73, rh9, fc1, and fc2) from atrpms, if you 
configure an rpm-dir in sources.list that doesn't exist on the local 
disk, then apt will core dump.  Even more fun, it will say "E: The 
package cache file is corrupted" for apt-cache operations.  Running 
"apt-get check" in gdb gives:

#0  0x4014056d in rpmtsFree () from /usr/lib/librpm-4.3.so
#1  0x40079a18 in RPMDirHandler::~RPMDirHandler() ()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#2  0x40082985 in rpmPkgDirIndex::Size() const ()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#3  0x400dba8d in pkgCacheGenerator::WriteUniqString(char const*, 
unsigned) ()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#4  0x400dc1ec in pkgMakeStatusCache(pkgSourceList&, OpProgress&, 
MMap**, bool)
    () from /usr/lib/libapt-pkg-libc6.3-5.so.0
#5  0x400c21df in pkgCacheFile::BuildCaches(OpProgress&, bool) ()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#6  0x400c2354 in pkgCacheFile::Open(OpProgress&, bool) ()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#7  0x0805cc8f in strcpy ()
#8  0x40064ed9 in CommandLine::DispatchArg(CommandLine::Dispatch*, bool) 
()
   from /usr/lib/libapt-pkg-libc6.3-5.so.0
#9  0x080615c6 in strcpy ()
#10 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6

The "update" also cores in the destructor of the RPMDirHandler.  Maybe 
something ends up NULL on the way in.  Like it's assuming a transaction 
set is open when it never really did because the directory didn't exist 
or something funky.  I don't have the code, so I don't know.

The non-code solution is to remove the rpm-dir.

Oh, and, if you've fixed it .. thanks!  Just couldn't find why on 
Google, so I decided to post this for mass consumption... 

take care,
-- 
-jeff