Patch: apt-get -s and "E: Conf Broken ..." errors

Norbert Warmuth <[email protected]> 11 Feb 2005 20:10:36 +0100
Newsgroups gmane.linux.conectiva.apt-rpm
Message-ID <[email protected]>
Hi,

while preparing migrations from Redhat 7.3 to RHEL 3 I noticed two
annoying issues with simulation mode (apt-get -s):

1. requires-obsoletes-requires loops are not detected and result
   in "E: Fatal, conflicts violated ..." errors.

2. Obsoleted packages are not handled correctly and result in 
   "E: Conf Broken ..." errors.


As no. 2 breaks simulation mode completely for the aforementioned 
migrations I investigated and found a solution for this issue (see the
attached patches). 


Set of RHEL3 packages to reproduce on a RH 7.3 system:
    db4-4.1.25-8.i386.rpm
    glibc-2.3.2-95.6.i686.rpm
    glibc-common-2.3.2-95.6.i386.rpm
    libgcc-3.2.3-24.i386.rpm
    tzdata-2003c-1.noarch.rpm

glibc-common requires `tzdata >= 2003a'
tzdata conflicts with `glibc-common <= 2.3.2-63'
db4 obsoletes db1


* Output without patch (lacks a `Remv db1'):
redhat73# apt-get -s install /var/tmp/rhel/*
Reading Package Lists... Done
Building Dependency Tree... Done
Selecting db4 for '/var/tmp/rhel/db4-4.1.25-8.i386.rpm'
Selecting glibc for '/var/tmp/rhel/glibc-2.3.2-95.6.i686.rpm'
Selecting glibc-common for '/var/tmp/rhel/glibc-common-2.3.2-95.6.i386.rpm'
Selecting libgcc for '/var/tmp/rhel/libgcc-3.2.3-24.i386.rpm'
Selecting tzdata for '/var/tmp/rhel/tzdata-2003c-1.noarch.rpm'
The following packages will be upgraded
  glibc glibc-common
The following packages will be REPLACED:
  db1 (by db4)
The following packages will be REMOVED:
  gcc gcc-c++ glibc-devel
The following NEW packages will be installed:
  db4 libgcc tzdata
2 upgraded, 3 newly installed, 1 replaced, 3 removed and 0 not upgraded.
Remv gcc-c++ (2.96-113 redhat:7.3/stable)
Remv gcc (2.96-113 redhat:7.3/stable)
Remv glibc-devel (2.2.5-44 redhat:7.3/stable)
Inst libgcc (3.2.3-24 localhost)
Inst tzdata (2003c-1 localhost) [tzdata on glibc-common] []
Inst glibc-common [2.2.5-44] (2.3.2-95.6 localhost) [glibc-common on
glibc] [glibc ]
Inst glibc [2.2.5-44] (2.3.2-95.6 localhost)
Inst db4 (4.1.25-8 localhost) [db4 on db1] []
Conf libgcc (3.2.3-24 localhost) []
Conf tzdata (2003c-1 localhost) []
Conf glibc-common (2.3.2-95.6 localhost) []
Conf glibc (2.3.2-95.6 localhost) []
Conf db4 broken
 Obsoletes:db1
 []
E: Fatal, conflicts violated tzdata
E: Fatal, conflicts violated glibc-common
E: Conf Broken db4
redhat73# 


* output with patch:
redhat73# apt-get -s install /var/tmp/rhel/*
Reading Package Lists... Done
Building Dependency Tree... Done
Selecting db4 for '/var/tmp/rhel/db4-4.1.25-8.i386.rpm'
Selecting glibc for '/var/tmp/rhel/glibc-2.3.2-95.6.i686.rpm'
Selecting glibc-common for '/var/tmp/rhel/glibc-common-2.3.2-95.6.i386.rpm'
Selecting libgcc for '/var/tmp/rhel/libgcc-3.2.3-24.i386.rpm'
Selecting tzdata for '/var/tmp/rhel/tzdata-2003c-1.noarch.rpm'
The following packages will be upgraded
  glibc glibc-common
The following packages will be REPLACED:
  db1 (by db4)
The following packages will be REMOVED:
  gcc gcc-c++ glibc-devel
The following NEW packages will be installed:
  db4 libgcc tzdata
2 upgraded, 3 newly installed, 1 replaced, 3 removed and 0 not upgraded.
Remv db1 (1.85-8 redhat:7.3/stable)
Remv gcc-c++ (2.96-113 redhat:7.3/stable)
Remv gcc (2.96-113 redhat:7.3/stable)
Remv glibc-devel (2.2.5-44 redhat:7.3/stable)
Inst libgcc (3.2.3-24 localhost)
Inst tzdata (2003c-1 localhost) [tzdata on glibc-common] []
Inst glibc-common [2.2.5-44] (2.3.2-95.6 localhost) [glibc-common on 
glibc] [glibc ]
Inst glibc [2.2.5-44] (2.3.2-95.6 localhost)
Inst db4 (4.1.25-8 localhost)
Conf libgcc (3.2.3-24 localhost)
Conf tzdata (2003c-1 localhost)
Conf glibc-common (2.3.2-95.6 localhost)
Conf glibc (2.3.2-95.6 localhost)
Conf db4 (4.1.25-8 localhost)
E: Fatal, conflicts violated tzdata
E: Fatal, conflicts violated glibc-common
redhat73#


Attached find two patches:

apt-0.5.15cnc6-remove-obsoletes-2a.diff takes the conservative
approach and adds an
   if (_config->FindB("APT::Get::Simulate") == false) {
   }
thus it affects simulation mode only.

apt-0.5.15cnc6-remove-obsoletes-2b.diff is more radical and effects
both simulation mode and the actual upgrade. I have been using it
quite some while and haven't anticipated any new problems.

Please consider applying either of both patches.

Thanks and regards,
Norbert Warmuth

_______________________________________________
apt-rpm mailing list
[email protected]
http://distro2.conectiva.com.br/mailman/listinfo/apt-rpm
apt-0.5.15cnc6-remove-obsoletes-2a.diff (text/x-patch, 1.2 KB)
diff -Nur apt-0.5.15cnc6.vanilla/apt-pkg/packagemanager.cc apt-0.5.15cnc6/apt-pkg/packagemanager.cc
--- apt-0.5.15cnc6.vanilla/apt-pkg/packagemanager.cc	Fri Nov 14 21:16:26 2003
+++ apt-0.5.15cnc6/apt-pkg/packagemanager.cc	Mon Apr  5 14:01:11 2004
@@ -424,14 +424,16 @@
    List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
    
    /* CNC:2003-01-29 - Do not remove obsoleted packages. */
-   for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
-   {
-      if (D->Type == pkgCache::Dep::Obsoletes &&
-          Cache[D.ParentPkg()].Install() &&
-          (pkgCache::Version*)D.ParentVer() == Cache[D.ParentPkg()].InstallVer &&
-          Cache.VS().CheckDep(Pkg.CurrentVer().VerStr(), D) == true)
+   if (_config->FindB("APT::Get::Simulate") == false) {
+      for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
       {
-         return true;
+	 if (D->Type == pkgCache::Dep::Obsoletes &&
+	    Cache[D.ParentPkg()].Install() &&
+	    (pkgCache::Version*)D.ParentVer() == Cache[D.ParentPkg()].InstallVer &&
+	    Cache.VS().CheckDep(Pkg.CurrentVer().VerStr(), D) == true)
+	 {
+	    return true;
+	 }
       }
    }
apt-0.5.15cnc6-remove-obsoletes-2b.diff (text/x-patch, 898 B)
diff -Nur apt-0.5.15cnc6.vanilla/apt-pkg/packagemanager.cc apt-0.5.15cnc6/apt-pkg/packagemanager.cc
--- apt-0.5.15cnc6.vanilla/apt-pkg/packagemanager.cc	Fri Nov 14 21:16:26 2003
+++ apt-0.5.15cnc6/apt-pkg/packagemanager.cc	Sun Apr  4 20:59:58 2004
@@ -423,18 +423,6 @@
 
    List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
    
-   /* CNC:2003-01-29 - Do not remove obsoleted packages. */
-   for (pkgCache::DepIterator D = Pkg.RevDependsList(); D.end() == false; D++)
-   {
-      if (D->Type == pkgCache::Dep::Obsoletes &&
-          Cache[D.ParentPkg()].Install() &&
-          (pkgCache::Version*)D.ParentVer() == Cache[D.ParentPkg()].InstallVer &&
-          Cache.VS().CheckDep(Pkg.CurrentVer().VerStr(), D) == true)
-      {
-         return true;
-      }
-   }
-   
    return Remove(Pkg,(Cache[Pkg].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge);
 }
 									/*}}}*/