segfault when doing apt-get install

Panu Matilainen pmatilai at laiskiainen.org
Fri Jun 9 07:29:16 PDT 2006


On Fri, 9 Jun 2006, Daisuke SUZUKI wrote:

>
> 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..
> **

Whoa.. what's curious is why it doesn't segfault on *all* new installs. 
Slightly different version of the patch applied (arch is only needed on 
removals so only look it up in that codepath), thanks for spotting this.

 	- Panu -



More information about the Apt-Rpm mailing list