summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/dpkgpm.cc32
-rw-r--r--apt-pkg/depcache.cc1
-rw-r--r--apt-pkg/init.cc3
-rw-r--r--apt-pkg/init.h2
4 files changed, 30 insertions, 8 deletions
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 01808be24..30f3b7d0f 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -1289,7 +1289,7 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
string::size_type pos;
FILE *report;
- if (_config->FindB("Dpkg::ApportFailureReport", false) == false)
+ if (_config->FindB("Dpkg::ApportFailureReport", true) == false)
{
std::clog << "configured to not write apport reports" << std::endl;
return;
@@ -1316,16 +1316,34 @@ void pkgDPkgPM::WriteApportReport(const char *pkgpath, const char *errormsg)
}
// do not report out-of-memory failures
- if(strstr(errormsg, strerror(ENOMEM)) != NULL) {
+ if(strstr(errormsg, strerror(ENOMEM)) != NULL ||
+ strstr(errormsg, "Cannot allocate memory") != NULL) {
std::clog << _("No apport report written because the error message indicates a out of memory error") << std::endl;
return;
}
- // do not report dpkg I/O errors
- // XXX - this message is localized, but this only matches the English version. This is better than nothing.
- if(strstr(errormsg, "short read in buffer_copy (")) {
- std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << 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;
+ io_errors.push_back(string("failed to read on buffer copy for %s"));
+ io_errors.push_back(string("failed in write on buffer copy for %s"));
+ io_errors.push_back(string("short read on buffer copy for %s"));
+
+ for (vector<string>::iterator I = io_errors.begin(); I != io_errors.end(); I++)
+ {
+ vector<string> list = VectorizeString(dgettext("dpkg", (*I).c_str()), '%');
+ if (list.size() > 1) {
+ // we need to split %s, VectorizeString only allows char so we need
+ // to kill the "s" manually
+ if (list[1].size() > 1) {
+ list[1].erase(0, 1);
+ if(strstr(errormsg, list[0].c_str()) &&
+ strstr(errormsg, list[1].c_str())) {
+ std::clog << _("No apport report written because the error message indicates a dpkg I/O error") << std::endl;
+ return;
+ }
+ }
+ }
}
// get the pkgname and reportfile
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index bef977532..09a2cac2d 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -927,6 +927,7 @@ bool pkgDepCache::IsDeleteOk(PkgIterator const &Pkg,bool rPurge,
if (FromUser == false && Pkg->CurrentVer == 0)
{
StateCache &P = PkgState[Pkg->ID];
+ // Status == 2 means this applies for new installs only
if (P.InstallVer != 0 && P.Status == 2 && (P.Flags & Flag::Auto) != Flag::Auto)
{
if (DebugMarker == true)
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index a30f27844..0354e6e4d 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -84,6 +84,9 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.disabled$");
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.bak$");
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.dpkg-[a-z]+$");
+ // ubuntu specific
+ Cnf.Set("Dir::Ignore-Files-Silently::", "\\.distUpgrade$");
+ Cnf.Set("Dir::Ignore-Files-Silently::", "\\.save$");
// Translation
Cnf.Set("APT::Acquire::Translation", "environment");
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index 15a1165b9..6d3ef953c 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -21,7 +21,7 @@
// reverse-dependencies of libapt-pkg against the new SONAME.
// Non-ABI-Breaks should only increase RELEASE number.
// See also buildlib/libversion.mak
-#define APT_PKG_MAJOR 4
+#define APT_PKG_MAJOR 4
#define APT_PKG_MINOR 10
#define APT_PKG_RELEASE 1