Bug#166758: Apt patch,
I haven't seen any discussion here on a time-frame for a fix (I'm sure
it's a complicated fix), so I've implemented Daniel's idea of having a
better error message.
The attached patch will warn the user that they've run into this
limitation, and give them useful suggestions. It also includes a link
to this bug. I think this will dramatically reduce the number of
duplicate bugs due to this issue. I assume more and more people are
going to run into this issue. I currently only have
unstable/testing/stable and security, and I run into this issue.
Clearing out the uninstalled packages out of my /var/lib/dpkg/status
file didn't help either :(
-Joe
Only in apt-0.5.4/apt-pkg: configuration.d
diff -ru apt-0.5.4/apt-pkg/pkgcachegen.cc apt-0.5.4-modded/apt-pkg/pkgcachegen.cc
--- apt-0.5.4/apt-pkg/pkgcachegen.cc Sun Jul 1 18:28:24 2001
+++ apt-0.5.4-modded/apt-pkg/pkgcachegen.cc Tue Jan 28 12:34:48 2003
@@ -93,6 +93,31 @@
Cache.HeaderP->Dirty = false;
Map.Sync(0,sizeof(pkgCache::Header));
}
+
+// CheckForMMapBug
+// ---------------------------------------------------------------------
+/* This performs a quick check to see if bug
+ http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=166758
+ has been encountered. If it has, then it provides some
+ suggestions. More and more people are going to run into
+ this as the suites get bigger, so best to eliminate duplicate
+ bugs until the problem is fixed.
+*/
+
+void CheckForMMapBug() {
+ //Look to see if the last error was the MMap error
+ string errorText;
+ bool type = _error->PopMessage(errorText);
+ _error->Error(errorText.c_str()); //Put it back where we found it
+ if (type && errorText == "Dynamic MMap ran out of room") {
+ _error->Warning("You've run into an APT limitation! For more information visit:\n\
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=166758\n\
+Here are some common workarounds:\n\
+1) Reduce the number of sources in your /etc/apt/sources.list file
+2) add \"APT::Cache-Limit=16777216;\" to your /etc/apt/apt.conf file");
+ } //Else: not the MMap bug!
+ _error->Error(errorText.c_str()); //Put it back where we found it
+}
/*}}}*/
// CacheGenerator::MergeList - Merge the package list /*{{{*/
// ---------------------------------------------------------------------
@@ -112,8 +137,10 @@
return false;
pkgCache::PkgIterator Pkg;
- if (NewPackage(Pkg,PackageName) == false)
+ if (NewPackage(Pkg,PackageName) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (NewPackage)"),PackageName.c_str());
+ }
Counter++;
if (Counter % 100 == 0 && Progress != 0)
Progress->Progress(List.Offset());
@@ -124,8 +151,10 @@
string Version = List.Version();
if (Version.empty() == true)
{
- if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false)
+ if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (UsePackage1)"),PackageName.c_str());
+ }
continue;
}
@@ -144,11 +173,15 @@
unsigned long Hash = List.VersionHash();
if (Res == 0 && Ver->Hash == Hash)
{
- if (List.UsePackage(Pkg,Ver) == false)
+ if (List.UsePackage(Pkg,Ver) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (UsePackage2)"),PackageName.c_str());
+ }
- if (NewFileVer(Ver,List) == false)
+ if (NewFileVer(Ver,List) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (NewFileVer1)"),PackageName.c_str());
+ }
// Read only a single record and return
if (OutVer != 0)
@@ -175,14 +208,19 @@
*Last = NewVersion(Ver,Version,*Last);
Ver->ParentPkg = Pkg.Index();
Ver->Hash = Hash;
- if (List.NewVersion(Ver) == false)
+ if (List.NewVersion(Ver) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (NewVersion1)"),PackageName.c_str());
-
- if (List.UsePackage(Pkg,Ver) == false)
+ }
+ if (List.UsePackage(Pkg,Ver) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (UsePackage3)"),PackageName.c_str());
+ }
- if (NewFileVer(Ver,List) == false)
+ if (NewFileVer(Ver,List) == false) {
+ CheckForMMapBug();
return _error->Error(_("Error occured while processing %s (NewVersion2)"),PackageName.c_str());
+ }
// Read only a single record and return
if (OutVer != 0)
Reply to: