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

Re: dpkg 1.8.1.2 gives SIGBUS on sparc



Ben Collins <bcollins@debian.org> writes:

> Ok, I've narrowed down the offending code to this 40k patch. Note, it
> has nothing to do with the zlib using code, since I already tried
> compiling --without-zlib, and it still gives a sigbus. If I take this
> patch and do a -R with it on a 1.8.0 tree, and compile, I get no sigbus.
> I've spent way too much time messing with this already, so I'm turning
> it over to someone (doogie?) else to work with.

I couldn't find the error, but I found the exact place where it gets
the Bus error. In the file main/processarc.c, function
process_archive(), where it looks like this (the fprintf's are mine):


      debug(dbg_eachfile, "process_archive: checking %s for same files on "
          "upgrade/downgrade", fnamevb.buf);
      if (!lstat(fnamevb.buf, &oldfs) && !S_ISDIR(oldfs.st_mode)) {
        for (cfile = newfileslist; cfile; cfile = cfile->next) {
          if (!cfile->namenode->filestat) {
            cfile->namenode->filestat = (struct stat *) nfmalloc(sizeof(struct stat));
fprintf(stderr, "%s(%d): cfile=%p\n", __FILE__, __LINE__, cfile);
fprintf(stderr, "%s(%d): cfile->namenode=%p\n", __FILE__, __LINE__, cfile->namenode);
fprintf(stderr, "%s(%d): cfile->namenode->filestat=%p\n", __FILE__, __LINE__, cfile->namenode->filestat);
fprintf(stderr, "%s(%d): cfile->namenode->name=%p\n", __FILE__, __LINE__, cfile->namenode->name);
fprintf(stderr, "%s(%d): cfile->namenode->name='%s'\n", __FILE__, __LINE__, cfile->namenode->name);
            if (lstat(cfile->namenode->name, cfile->namenode->filestat)) {
fprintf(stderr, "%s(%d)\n", __FILE__, __LINE__);
              cfile->namenode->filestat= 0;
              continue;
            }
fprintf(stderr, "%s(%d)\n", __FILE__, __LINE__);
          }


The printout of these fprintf's is:

/home/tomas/src/dpkg/main/processarc.c(603): cfile=0xadfc0
/home/tomas/src/dpkg/main/processarc.c(604): cfile->namenode=0x55086c
/home/tomas/src/dpkg/main/processarc.c(605): cfile->namenode->filestat=0x8496ac
/home/tomas/src/dpkg/main/processarc.c(606): cfile->namenode->name=0x550894
/home/tomas/src/dpkg/main/processarc.c(607): cfile->namenode->name='/.'
Bus error


If I change the offending line

            if (lstat(cfile->namenode->name, cfile->namenode->filestat)) {

into

            if (1 || lstat(cfile->namenode->name, cfile->namenode->filestat)) {

as if the lstat always fails, the installation will proceed, and
finish without crashes.

It always crashes the first time it reaches this point. I can't see
anything weird with the pointers printed out above. They all seem
properly aligned to me. Since it crashes in lstat(), could it be a
libc bug after all?

Well, I hope you guys understand more of this, than I do. :)


Greetings,

Tomas



Reply to: