[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Segmentation fault on libapt



El lun, 11-02-2002 a las 22:38, Matt Zimmerman escribió:
> On Mon, Feb 11, 2002 at 10:32:20PM +0000, Ayose wrote:
> 
> > I recive a segmentation fault when I run apt-get, apt-cache, aptitude,
> > or anything which uses libapt-pkg-libc6.2-3-2.so.3.2. I'm not able to
> > resolve the proble myself, so I wrote to you :-)
> > 
> > What could be the problem of libapt?
> > 
> > P.S. 
> > To excuse to me if this is not the correct list, but I have not
> > considered this failure as important as to send it to bugs.debian.org
> 
> Typically, this means that your APT cache has become corrupted.  Try:
> 
> rm /var/cache/apt/*.bin
> apt-get update
> 

That is no the solution :-(

[0]setepo# rm /var/cache/apt/*.bin
rm: remove `/var/cache/apt/pkgcache.bin'? y
[0]setepo# apt-get update
Hit ftp://ftp.de.debian.org sid/main Packages
Hit ftp://ftp.de.debian.org sid/main Release
Reading Package Lists... Error!
E: Unable to write mmap - msync (2 No such file or directory)
E: The package lists or status file could not be parsed or opened.
[0]setepo# apt-cache dump
Violación de segmento
[0]setepo# 

<note> "Violación de segmento" is a segmentation fault (in
spanish).</note>

I'll try to give you more information about the crash:

I've downloaded the source of apt from packages.debian.org (apt-get
source doesn't work) and compile it.

Here is the output of ldd(1)

[0]bin$ pwd
/tmp/apt-0.5.4/bin
[0]bin$ ldd apt-cache 
	libapt-pkg-libc6.2-3-2.so.3.2 => ./libapt-pkg-libc6.2-3-2.so.3.2
(0x40016000)
	libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3
(0x40105000)
	libm.so.6 => /lib/libm.so.6 (0x4014f000)
	libc.so.6 => /lib/libc.so.6 (0x40171000)
	/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)


After that, I start gdb. I attached the output of gdb in gdb1.txt

And, finally, this is the output os strace(1):

[0]bin$ strace apt-cache dump 2>&1 | tail -5
fstat64(3, {st_mode=S_IFREG|0644, st_size=8555, ...}) = 0
old_mmap(NULL, 8555, PROT_READ, MAP_SHARED, 3, 0) = 0x40016000
stat64("/var/lib/apt/lists/ftp.de.debian.org_debian_dists_sid_main_binary-i386_Packages", {st_mode=S_IFREG|0644, st_size=6198352, ...}) = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++
[0]bin$ 



I hope that this new information is useful :-)

-- 
Ayose Cazorla León
Debian GNU/Linux - setepo
(gdb) run dump
Starting program: /tmp/apt-0.5.4/bin/apt-cache dump

Program received signal SIGSEGV, Segmentation fault.
0x400b94d2 in debPackagesIndex::FindInCache (this=0x8059e88, Cache=@0xbffff53c)
    at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/straits.h:125
125	    { return strlen (s); }
(gdb) bt
#0  0x400b94d2 in debPackagesIndex::FindInCache (this=0x8059e88, Cache=@0xbffff53c)
    at /usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/std/straits.h:125
#1  0x400924f9 in CheckValidity (CacheFile=0xbffff780, Start=0x8058380, End=0x8058388, OutMap=0xbffff7e4)
    at pkgcachegen.cc:517
#2  0x4009376c in pkgMakeStatusCache (List=@0x8059e48, Progress=@0xbffff7e8, OutMap=0xbffff7e4, 
    AllowMem=true) at pkgcachegen.cc:625
#3  0x08052ee9 in main (argc=2, argv=0xbffffa14) at apt-cache.cc:1378
#4  0x4018e6cf in __libc_start_main () from /lib/libc.so.6
(gdb) list 
120	  static bool is_del(char_type a) { return isspace(a); }
121	
122	  static int compare (const char_type* s1, const char_type* s2, size_t n)
123	    { return memcmp (s1, s2, n); }
124	  static size_t length (const char_type* s)
125	    { return strlen (s); }
126	  static char_type* copy (char_type* s1, const char_type* s2, size_t n)
127	    { return (char_type*) memcpy (s1, s2, n); }
128	  static char_type* move (char_type* s1, const char_type* s2, size_t n)
129	    { return (char_type*) memmove (s1, s2, n); }
(gdb) list pkgcachegen.cc:517
512				  (*Start)->Describe().c_str());
513		 continue;
514	      }
515	
516	      // FindInCache is also expected to do an IMS check.
517	      pkgCache::PkgFileIterator File = (*Start)->FindInCache(Cache);
518	      if (File.end() == true)
519		 return false;
520	      
521	      Visited[File->ID] = true;
(gdb) list pkgcachegen.cc:625
620	      return _error->Error(_("Unable to write to %s"),flNotFile(CacheFile).c_str());
621	   
622	   Progress.OverallProgress(0,1,1,_("Reading Package Lists"));
623	   
624	   // Cache is OK, Fin.
625	   if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true)
626	   {
627	      Progress.OverallProgress(1,1,1,_("Reading Package Lists"));
628	      return true;
629	   }
(gdb) 

Reply to: