@edgy - segmentation fault strlen - implicated apt-get, aptitude, synaptic, adept

Bug #57140 reported by ryuujin
2
Affects Status Importance Assigned to Milestone
Ubuntu
New
Undecided
Unassigned

Bug Description

Hi,
when I try to use apt-get (or similar) I found a Segmentation Fault:

apt-get dist-upgrade
Segmentation faulta dei pacchetti in corso... 0%

I tried to debug this with gdb, and:
-------
(gdb) run dist-upgrade
Starting program: /usr/bin/apt-get dist-upgrade
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
Lettura della lista dei pacchetti in corso... 0%
Program received signal SIGSEGV, Segmentation fault.
0xb7d19673 in strlen () from /lib/libc.so.6
(gdb) x/i $eip
0xb7d19673 <strlen+51>: mov (%eax),%ecx
(gdb) info stack
#0 0xb7d19673 in strlen () from /lib/libc.so.6
#1 0xb7e8e126 in std::string::compare () from /usr/lib/libstdc++.so.6
#2 0xb7f7d428 in debPackagesIndex::FindInCache () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#3 0xb7f42b44 in pkgCacheGenerator::~pkgCacheGenerator () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#4 0xb7f439b7 in pkgMakeStatusCache () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#5 0xb7f3941c in pkgCacheFile::BuildCaches () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#6 0xb7f39504 in pkgCacheFile::Open () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#7 0x0805df6b in ?? ()
#8 0xb7f0613d in CommandLine::DispatchArg () from /usr/lib/libapt-pkg-libc6.4-6.so.3.51
#9 0x0804ee25 in ?? ()
#10 0xb7cc58cc in __libc_start_main (main=0x804eb86 <strcpy@plt+8186>, argc=2, ubp_av=0xbffe07c4,
    init=0x80635ed <std::vector<pkgSrcRecords::Parser::BuildDepRec, std::allocator<pkgSrcRecords::Parser::BuildDepRec> >::_M_insert_aux(__gnu_cxx::__normal_iterator<pkgSrcRecords::Parser::BuildDepRec*, std::vector<pkgSrcRecords::Parser::BuildDepRec, std::allocator<pkgSrcRecords::Parser::BuildDepRec> > >, pkgSrcRecords::Parser::BuildDepRec const&)+6573>,
    fini=0x80635e8 <std::vector<pkgSrcRecords::Parser::BuildDepRec, std::allocator<pkgSrcRecords::Parser::BuildDepRec> >::_M_insert_aux(__gnu_cxx::__normal_iterator<pkgSrcRecords::Parser::BuildDepRec*, std::vector<pkgSrcRecords::Parser::BuildDepRec, std::allocator<pkgSrcRecords::Parser::BuildDepRec> > >, pkgSrcRecords::Parser::BuildDepRec const&)+6568>,
    rtld_fini=0xb7fc5290 <_dl_rtld_di_serinfo+24112>, stack_end=0xbffe07bc) at libc-start.c:231
#11 0x0804cbc1 in ?? ()
(gdb)
------

It seems the problem is in strlen. So I tryed this simple source:
#include <strings.h>
#include <stdio.h>
int main(int argc, char **argv)
{
        if(argc>1)
                printf("%d",strlen(argv[2]));

        return 0;
}

and:
./a.out a
Segmentation fault (core dumped)

I've core files and other details if they'll be necessary.

Thanks...

..ryuujin

Revision history for this message
Micah Cowan (micahcowan) wrote :

Your test program is guaranteed to fail. You do strlen() on a nonexistant string (I think you wanted argv[1], which would give you the "a").

It is extremely unlikely that the problem is actually in strlen(): strlen() only uncovered the problem.

Revision history for this message
ryuujin (mirchaemanuel) wrote : Re: [Bug 57140] Re: @edgy - segmentation fault strlen - implicated apt-get, aptitude, synaptic, adept

2006/8/21, Micah Cowan <email address hidden>:
>
> Your test program is guaranteed to fail. You do strlen() on a
> nonexistant string (I think you wanted argv[1], which would give you the
> "a").

You right... :) argv[1]

It is extremely unlikely that the problem is actually in strlen():
> strlen() only uncovered the problem.

I resolved with rm /var/cache/apt/*.bin
and I can understand why...

Revision history for this message
honkitonk (kaynehrzuhause) wrote :

I had the same problem. It works after removing the suggested bins.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.