← Back to team overview

touch-packages team mailing list archive

[Bug 1450966] Re: apt-get install segfault

 

It looks like it still may be an issue in Vivid - from apt-
pkg/depcache.cc:

            // now check if we should consider it a automatic dependency or not
            if(InstPkg->CurrentVer == 0 && InstVer->Section != 0 && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", InstVer.Section()))
            {  
               if(DebugAutoInstall == true)
                  std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "
                            << Start.DepType() << " of pkg in APT::Never-MarkAuto-Sections)" << std::endl;
               MarkAuto(InstPkg, false);
            }


** Changed in: apt (Ubuntu)
   Importance: Undecided => Medium

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1450966

Title:
  apt-get install segfault

Status in apt package in Ubuntu:
  Confirmed

Bug description:
  Package: apt
  Version: apt-0.8.16~exp12ubuntu10.22
  root@0fb5fe4c0c0f:/build/apt-0.8.16~exp12ubuntu10.22# lsb_release -rd
  Description:    Ubuntu 12.04.5 LTS
  Release:        12.04

  Expected to happen: running "apt-get install [ package ]" installs the
  package

  What happened: running "apt-get install [ package ]" encounters a
  segfault

  Debug notes:

  This occurred while installing a package that depends on many other
  packages.  The package I was installing had "Section" defined, while
  the offending dependent package did not have "Section" defined.

  I built apt from source with debug symbols and located found the issue
  occurs because a NULL value is being passed to strcmp (frame 1).  This
  happens because a prior function (frame 2) assumes that if the parent
  package has "Section" defined, then the defendant package will also
  have "Section" defined as well.

  Adding the "Section" field to the offending package works around the
  segfault issue.

  Given that the policy manual (https://www.debian.org/doc/debian-policy
  /ch-controlfields.html) states that section is recommended it's
  technically correct to have a packge omit the Section field, and as
  such, apt should tolerate this situation.

  GDB:

  Program received signal SIGSEGV, Segmentation fault.
  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:163
  163     ../sysdeps/x86_64/multiarch/strcmp-sse42.S: No such file or directory.
  (gdb) where
  #0  __strcmp_sse42 () at ../sysdeps/x86_64/multiarch/strcmp-sse42.S:163
  #1  0x00007ffff7ad7479 in ConfigValueInSubTree (SubTree=0x7ffff7b85879 "APT::Never-MarkAuto-Sections", needle=0x0) at depcache.cc:53
  #2  0x00007ffff7adcb54 in pkgDepCache::MarkInstall (this=0x668fb0, Pkg=..., AutoInst=true, Depth=0, FromUser=true,
      ForceImportantDeps=false) at depcache.cc:1208
  #3  0x0000000000431259 in TryToInstall::doAutoInstall (this=0x7fffffffd710) at apt-get.cc:878
  #4  0x00000000004218a7 in DoInstall (CmdL=...) at apt-get.cc:1901
  #5  0x00007ffff7abe322 in CommandLine::DispatchArg (this=0x7fffffffe5f0, Map=0x7fffffffe4b0, NoMatch=true) at contrib/cmndline.cc:337
  #6  0x000000000042c109 in main (argc=5, argv=0x7fffffffe738) at apt-get.cc:3523

  Frame 1, NULL value getting passed to strcmp

  (gdb) f 1 
  #1  0x00007ffff7ad7479 in ConfigValueInSubTree (SubTree=0x7ffff7b85879 "APT::Never-MarkAuto-Sections", needle=0x0) at depcache.cc:53
  53               if (strcmp(needle, Opts->Value.c_str()) == 0)
  (gdb) p needle
  $4 = 0x0
  (gdb) list
  48            Opts = Opts->Child;
  49            for (; Opts != 0; Opts = Opts->Next)
  50            {
  51               if (Opts->Value.empty() == true)
  52                  continue;
  53               if (strcmp(needle, Opts->Value.c_str()) == 0)
  54                  return true;
  55            }
  56         }
  57         return false;

  
  Frame 2, code assumes InstVer.Section() is non-null if Pkg.Section() evaluates to true.

  (gdb) f 2
  #2  0x00007ffff7adcb54 in pkgDepCache::MarkInstall (this=0x668fb0, Pkg=..., AutoInst=true, Depth=0, FromUser=true, 
      ForceImportantDeps=false) at depcache.cc:1208
  1208                if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", InstVer.Section()))
  (gdb) p Pkg.Section()
  $2 = 0x7ffff5b1325e "Optional"
  (gdb) p InstVer.Section()
  $6 = 0x0
  (gdb) list
  1203                if(DebugAutoInstall == true)
  1204                   std::clog << OutputInDepth(Depth) << "Installing " << InstPkg.Name()
  1205                             << " as " << Start.DepType() << " of " << Pkg.Name()
  1206                             << std::endl;
  1207                // now check if we should consider it a automatic dependency or not
  1208                if(Pkg.Section() && ConfigValueInSubTree("APT::Never-MarkAuto-Sections", InstVer.Section()))
  1209                {
  1210                   if(DebugAutoInstall == true)
  1211                      std::clog << OutputInDepth(Depth) << "Setting NOT as auto-installed (direct "
  1212                                << Start.DepType() << " of pkg in APT::Never-MarkAuto-Sections)" << std::endl;

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1450966/+subscriptions


References