segfault when doing apt-get install

Daisuke SUZUKI daisuke at linux.or.jp
Fri Jun 9 06:35:16 PDT 2006


Hi Panu and all,

On Mon, 29 May 2006 23:25:50 -0700 (PDT)
Panu Matilainen <pmatilai at laiskiainen.org> wrote:

> I spotted a bug couple of days ago where apt-rpm can crash with install 
> /some/path when using non-repomd repositories if it encounters a package 
> with no files in it. It's a bit curious because the code has been 
> virtually unchanged since forever. This cures that particular problem:
> svn diff -r180:181 http://svn.laiskiainen.org/apt-rpm/trunk/
> 
> If that doesn't help I'm going to need a backtrace of the crash.

I encounterd the problem looks like on doing "apt-get install xxx".
it caused segfault. (xxx is new package that is not installed yet)
# This problem does not occur always...

I've applyed the svn diff, but it does not solve the problem.
also I tried "rpm --rebuilddb" and "apt-get clean", but it does help.

The backtrace of the crash is following;

#0  0xb783363a in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string () from /usr/lib/libstdc++.so.5
#1  0xb7e8150a in pkgRPMPM::Go () from /usr/lib/libapt-pkg-libc6.3-5.so.2
#2  0xb7ec2885 in pkgPackageManager::DoInstall () from /usr/lib/libapt-pkg-libc6.3-5.so.2
#3  0x080531e5 in InstallPackages ()
#4  0x08059684 in DoInstall ()
#5  0xb7e35dea in CommandLine::DispatchArg () from /usr/lib/libapt-pkg-libc6.3-5.so.2
#6  0x08063271 in main ()

I check pkgRPMPM::Go() in rpmpm.cc and the crash point is following;

In "pkgRPMPM::Go()"

   for (vector<Item>::iterator I = List.begin(); I != List.end(); I++)
   {
      string Name = I->Pkg.Name();
      string Arch = I->Pkg.CurrentVer().Arch();
      ....

apt-get crashes on "I->Pkg.CurrentVer().Arch()".
When apt is going to install a new package, "I->Pkg.CurrentVer()" is NULL,
so It will causes segmentation fault.

I made the attached patch, and it fixes this problem.

**
BTW, I'm using apt with LANG=ja_JP.eucJP when I get this problem.
But running with LANG=C, the segv occurs *very* few times..
**

Thanks,

-- 
Daisuke SUZUKI <daisuke at linux.or.jp>
GnuPG Fingerprint = 7DE6 9AC6 5E5B 1AF8 B38E  0992 90BF 4C09 7432 2CB0
Founder & President, Project Vine.             http://vinelinux.org/
Founder & President, Vine Caves, Ltd.          http://vinecaves.com/
President, Japan Linux Association.            http://jla.linux.or.jp/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: apt-0.5.15lorg3.1-fix-segv.patch
Type: application/octet-stream
Size: 607 bytes
Desc: not available
URL: <http://lists.laiskiainen.org/pipermail/apt-rpm-laiskiainen.org/attachments/20060609/f62b95f0/attachment-0002.obj>


More information about the Apt-Rpm mailing list