Package: dpkg
Version: 1.14.20
Tags: patch

When I designed the way dselect [U]pdate works, I assumed that `more
trustworthy' repositories, ie ones which in the ftp method's [A]ccess
come later, would always have better information.  So when the ftp
method loads a sequence of Packages files, later ones always override
earlier ones.

This prevents an incompetent lower-priority source from accidentally
replacing your coreutils.  (Of course a _malicious_ lower-priority
source can do arbitrary harm, and there are plenty of other ways for a
package source to do damage so it's not perfect.)

However with the advent of testing-security it is now the case that
higher-priority sources can sometimes have worse data.  For example
right now testing-security has a lower version of e2fsprogs than
testing.  apt (and dselect apt acquisition) users do not notice this
because apt always prefers the source with the package with the higher
version number.

It is probably unrealistic to expect ftpmaster to adapt their working
practices.  Instead, I think I should change dselect to always prefer
apparently-later versions.

This patch achieves this, by changing the behaviour of
 dpkg --merge-avail
to always prefer newer versions in the existing available database.
I'm pretty sure nothing uses dpkg --merge-avail and friends except
non-apt dselect methods so this patch shoudl be safe.

Ian.

diff -ru orig/dpkg-1.14.20/lib/dpkg-db.h dpkg-1.14.20/lib/dpkg-db.h
--- orig/dpkg-1.14.20/lib/dpkg-db.h     2008-06-18 08:33:27.000000000 +0100
+++ dpkg-1.14.20/lib/dpkg-db.h  2008-08-22 19:17:24.000000000 +0100
@@ -327,7 +327,8 @@
   pdb_recordavailable   =001, /* Store in `available' in-core structures, not 
`status' */
   pdb_rejectstatus      =002, /* Throw up an error if `Status' encountered     
        */
   pdb_weakclassification=004, /* Ignore priority/section info if we already 
have any   */
-  pdb_ignorefiles       =010  /* Ignore files info if we already have them     
        */
+  pdb_ignorefiles       =010, /* Ignore files info if we already have them     
        */
+  pdb_ignoreolder       =020  /* Ignore packages with older versions already 
read      */
 };
 
 const char *illegal_packagename(const char *p, const char **ep);
Only in dpkg-1.14.20/lib: dpkg-db.h~
diff -ru orig/dpkg-1.14.20/lib/parse.c dpkg-1.14.20/lib/parse.c
--- orig/dpkg-1.14.20/lib/parse.c       2008-06-18 08:33:27.000000000 +0100
+++ dpkg-1.14.20/lib/parse.c    2008-08-22 19:17:33.000000000 +0100
@@ -298,6 +298,11 @@
 
     pigp= findpackage(newpig.name);
     pifp= (flags & pdb_recordavailable) ? &pigp->available : &pigp->installed;
+
+    if (flags & pdb_ignoreolder &&
+       versioncompare(&newpifp->version, &pifp->version) < 0)
+      continue;
+
     if (!pifp->valid) blankpackageperfile(pifp);
 
     /* Copy the priority and section across, but don't overwrite existing
Only in dpkg-1.14.20/lib: parse.c~
diff -ru orig/dpkg-1.14.20/src/update.c dpkg-1.14.20/src/update.c
--- orig/dpkg-1.14.20/src/update.c      2008-05-05 18:07:01.000000000 +0100
+++ dpkg-1.14.20/src/update.c   2008-08-22 19:17:20.000000000 +0100
@@ -82,7 +82,8 @@
     parsedb(vb.buf, pdb_recordavailable | pdb_rejectstatus, NULL, NULL, NULL);
 
   if (cipaction->arg != act_avclear)
-    count += parsedb(sourcefile, pdb_recordavailable | pdb_rejectstatus,
+    count += parsedb(sourcefile,
+                    pdb_recordavailable | pdb_rejectstatus | pdb_ignoreolder,
                      NULL, NULL, NULL);
 
   if (!f_noact) {
Only in dpkg-1.14.20/src: update.c~

-- 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to