~ubuntu-branches/debian/experimental/apt/experimental

« back to all changes in this revision

Viewing changes to apt-pkg/deb/dpkgpm.cc

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, David Kalnischkies, Steve Langasek, Michael Vogt
  • Date: 2013-12-07 14:54:31 UTC
  • mto: This revision was merged to the branch mainline in revision 50.
  • Revision ID: package-import@ubuntu.com-20131207145431-8av51jnzb9kz20ow
Tags: 0.9.14
[ David Kalnischkies ]
* merge ubuntus apport reporting changes to reduce diff
* enable NOISE for build logs to enable analyse
* introduce a vendor system to change sources.list
* add a vendor specific file to have configurable entities
* use a substvar to set the archive-keyring in debian/control
* cherry-pick ubuntus (disabled) net-update fixes
* generate apt-key script with vendor info about keys
* drop old /var/state to /var/lib transition artefacts

[ Steve Langasek ]
* prepare-release: declare the packages needed as source build deps.

[ Michael Vogt ]
* enable release based selection for deb-src (closes: 731102)
* document Dpkg::Progress-Fancy (closes: 726169), thanks to James McCoy
* vendor/makefile: fix build error for parallel builds
* Handle SIGWINCH in APT::Progress-Fancy=1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1622
1622
   }
1623
1623
 
1624
1624
   // do not report out-of-memory failures 
1625
 
   if(strstr(errormsg, strerror(ENOMEM)) != NULL) {
 
1625
   if(strstr(errormsg, strerror(ENOMEM)) != NULL ||
 
1626
      strstr(errormsg, "failed to allocate memory") != NULL) {
1626
1627
      std::clog << _("No apport report written because the error message indicates a out of memory error") << std::endl;
1627
1628
      return;
1628
1629
   }
1629
1630
 
1630
 
   // do not report dpkg I/O errors
1631
 
   // XXX - this message is localized, but this only matches the English version.  This is better than nothing.
1632
 
   if(strstr(errormsg, "short read in buffer_copy (")) {
1633
 
      std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
1634
 
      return;
 
1631
   // do not report bugs regarding inaccessible local files
 
1632
   if(strstr(errormsg, strerror(ENOENT)) != NULL ||
 
1633
      strstr(errormsg, "cannot access archive") != NULL) {
 
1634
      std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
 
1635
      return;
 
1636
   }
 
1637
 
 
1638
   // do not report errors encountered when decompressing packages
 
1639
   if(strstr(errormsg, "--fsys-tarfile returned error exit status 2") != NULL) {
 
1640
      std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
 
1641
      return;
 
1642
   }
 
1643
 
 
1644
   // do not report dpkg I/O errors, this is a format string, so we compare
 
1645
   // the prefix and the suffix of the error with the dpkg error message
 
1646
   vector<string> io_errors;
 
1647
   io_errors.push_back(string("failed to read on buffer copy for %s"));
 
1648
   io_errors.push_back(string("failed in write on buffer copy for %s"));
 
1649
   io_errors.push_back(string("short read on buffer copy for %s"));
 
1650
 
 
1651
   for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); I++)
 
1652
   {
 
1653
      vector<string> list = VectorizeString(dgettext("dpkg", (*I).c_str()), '%');
 
1654
      if (list.size() > 1) {
 
1655
         // we need to split %s, VectorizeString only allows char so we need
 
1656
         // to kill the "s" manually
 
1657
         if (list[1].size() > 1) {
 
1658
            list[1].erase(0, 1);
 
1659
            if(strstr(errormsg, list[0].c_str()) && 
 
1660
               strstr(errormsg, list[1].c_str())) {
 
1661
               std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
 
1662
               return;
 
1663
            }
 
1664
         }
 
1665
      }
1635
1666
   }
1636
1667
 
1637
1668
   // get the pkgname and reportfile
1723
1754
         char buf[1024];
1724
1755
         while( fgets(buf, sizeof(buf), log) != NULL)
1725
1756
            fprintf(report, " %s", buf);
 
1757
         fprintf(report, " \n");
 
1758
         fclose(log);
 
1759
      }
 
1760
   }
 
1761
 
 
1762
   // attach history log it if we have it
 
1763
   string histfile_name = _config->FindFile("Dir::Log::History");
 
1764
   if (!histfile_name.empty())
 
1765
   {
 
1766
      FILE *log = NULL;
 
1767
      char buf[1024];
 
1768
 
 
1769
      fprintf(report, "DpkgHistoryLog:\n");
 
1770
      log = fopen(histfile_name.c_str(),"r");
 
1771
      if(log != NULL)
 
1772
      {
 
1773
         while( fgets(buf, sizeof(buf), log) != NULL)
 
1774
            fprintf(report, " %s", buf);
1726
1775
         fclose(log);
1727
1776
      }
1728
1777
   }