]> git.saurik.com Git - apt.git/commitdiff
merged lp:~brian-murray/apt/history-log
authorMichael Vogt <michael.vogt@ubuntu.com>
Mon, 6 Jun 2011 14:36:28 +0000 (16:36 +0200)
committerMichael Vogt <michael.vogt@ubuntu.com>
Mon, 6 Jun 2011 14:36:28 +0000 (16:36 +0200)
apt-pkg/deb/dpkgpm.cc
debian/changelog

index 30f3b7d0f6dee5f5678bfcfd59404973f7dcbcff..b9f49365dd090dae1994f09b39e44e0f392c099a 100644 (file)
@@ -1322,6 +1322,13 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
       return;
    }
 
       return;
    }
 
+   // do not report bugs regarding inaccessible local files
+   if(strstr(errormsg, strerror(ENOENT)) != NULL ||
+      strstr(errormsg, "Cannot access archive") != NULL) {
+      std::clog << _("No apport report written because the error message indicates an issue on the local system") << std::endl;
+      return;
+   }
+
    // do not report dpkg I/O errors, this is a format string, so we compare
    // the prefix and the suffix of the error with the dpkg error message
    vector<string> io_errors;
    // do not report dpkg I/O errors, this is a format string, so we compare
    // the prefix and the suffix of the error with the dpkg error message
    vector<string> io_errors;
@@ -1439,6 +1446,23 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
       }
    }
 
       }
    }
 
+   // attach history log it if we have it
+   string histfile_name = _config->FindFile("Dir::Log::History");
+   if (!histfile_name.empty())
+   {
+      FILE *log = NULL;
+      char buf[1024];
+
+      fprintf(report, "DpkgHistoryLog:\n");
+      log = fopen(histfile_name.c_str(),"r");
+      if(log != NULL)
+      {
+        while( fgets(buf, sizeof(buf), log) != NULL)
+           fprintf(report, " %s", buf);
+        fclose(log);
+      }
+   }
+
    // log the ordering 
    const char *ops_str[] = {"Install", "Configure","Remove","Purge"};
    fprintf(report, "AptOrdering:\n");
    // log the ordering 
    const char *ops_str[] = {"Install", "Configure","Remove","Purge"};
    fprintf(report, "AptOrdering:\n");
index 3e21120cf8038d3125c8c94592dbff2d047f41c1..8cc9b53e1c2c478b21b02d456ea36b7b6225b3bf 100644 (file)
@@ -1,3 +1,13 @@
+apt (0.8.14.1ubuntu6) UNRELEASEDoneiric; urgency=low
+
+  * apt-pkg/deb/dpkgpm.cc:
+    - prevent reporting of package installation failures due to inaccessible
+      local files (LP: #791102, #790040)
+    - include /var/log/apt/history.log in apport-package reports so we know
+      the context for the package management request
+
+ -- Brian Murray <brian@ubuntu.com>  Wed, 01 Jun 2011 12:32:31 -0700
+
 apt (0.8.14.1ubuntu5) oneiric; urgency=low
 
   * apt-pkg/acquire-item.cc:
 apt (0.8.14.1ubuntu5) oneiric; urgency=low
 
   * apt-pkg/acquire-item.cc: