[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#548858: apt fails to upgrade



On Tue, Sep 29, 2009 at 09:52:29AM +0200, Norbert Preining wrote:
[..]
> ithrandir:~# apt-get upgrade
> Reading package lists... Done
> Building dependency tree       
> Reading state information... Done
[..]
> 46 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
> Need to get 0B/49.6MB of archives.
> After this operation, 541kB of additional disk space will be used.
> Do you want to continue [Y/n]? 
> E: Internal Error, Could not perform immediate configuration (2) on perl
> 
> Same with aptitude and anything else
[..]

The ordering algorithm is failing here (its too agressive when
propergating the Immediate flag), the attached patch seems to fix the
problem (and thanks to David Kalnischkies who debugged the failure
with me). 

Cheers,
 Michael
=== modified file 'apt-pkg/packagemanager.cc'
--- apt-pkg/packagemanager.cc	2009-07-21 16:31:36 +0000
+++ apt-pkg/packagemanager.cc	2009-09-29 13:43:54 +0000
@@ -122,7 +122,7 @@
 /* This adds the immediate flag to the pkg and recursively to the
    dependendies 
  */
-void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer)
+void pkgPackageManager::ImmediateAdd(PkgIterator I, bool UseInstallVer, unsigned const int &Depth)
 {
    DepIterator D;
    
@@ -140,12 +140,16 @@
    for ( /* nothing */  ; D.end() == false; D++)
       if (D->Type == pkgCache::Dep::Depends || D->Type == pkgCache::Dep::PreDepends)
       {
+	 // ignore dependencies if no instal/upgrade/remove is going to happen
+	 if (D.TargetPkg() == 0 || Cache[D.TargetPkg()].Keep())
+	      continue;
+
 	 if(!List->IsFlag(D.TargetPkg(), pkgOrderList::Immediate))
 	 {
 	    if(Debug)
-	       clog << "ImmediateAdd(): Adding Immediate flag to " << I.Name() << endl;
+	       clog << OutputInDepth(Depth) << "ImmediateAdd(): Adding Immediate flag to " << D.TargetPkg() << " cause of " << D.DepType() << " " << I.Name() << endl;
 	    List->Flag(D.TargetPkg(),pkgOrderList::Immediate);
-	    ImmediateAdd(D.TargetPkg(), UseInstallVer);
+	    ImmediateAdd(D.TargetPkg(), UseInstallVer, Depth + 1);
 	 }
       }
    return;

=== modified file 'apt-pkg/packagemanager.h'
--- apt-pkg/packagemanager.h	2008-01-03 10:25:58 +0000
+++ apt-pkg/packagemanager.h	2009-09-29 13:41:50 +0000
@@ -49,7 +49,7 @@
    bool Debug;
          
    bool DepAdd(pkgOrderList &Order,PkgIterator P,int Depth = 0);
-   void ImmediateAdd(PkgIterator P, bool UseInstallVer);
+   void ImmediateAdd(PkgIterator P, bool UseInstallVer, unsigned const int &Depth = 0);
    virtual OrderResult OrderInstall();
    bool CheckRConflicts(PkgIterator Pkg,DepIterator Dep,const char *Ver);
    bool CreateOrderList();


Reply to: