[Reproducible-commits] [dpkg] 33/54: dpkg: Fix physical file offset comparison

Mattia Rizzolo mattia at debian.org
Fri Jan 15 18:54:01 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit 873b44e35962bf3be07c8950d768610d0a5710a5
Author: Yuri Gribov <tetra2005 at gmail.com>
Date:   Thu Dec 24 12:22:26 2015 +0100

    dpkg: Fix physical file offset comparison
    
    The comparison function pkg_sorter_by_listfile_phys_offs passed to qsort
    does not satisfy qsort symmetry requirements, for some inputs
    
      pkg_sorter_by_listfile_phys_offs(a, b) != -
      pkg_sorter_by_listfile_phys_offs(b, a)
    
    This may cause various qsort misbehaviors e.g. failing to properly sort
    the input array (on some platforms qsort could even abort although that
    seems to not be the case for glibc-based systems).
    
    Closes: #808912
    Signed-off-by: Guillem Jover <guillem at debian.org>
    Stable-Candidate: 1.16.x 1.17.x
---
 debian/changelog | 2 ++
 src/filesdb.c    | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 70bde36..f2c4dbe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,8 @@ dpkg (1.18.4) UNRELEASED; urgency=medium
     Thanks to Hanno Böck <hanno at hboeck.de>.
   * Add experimental multithreaded xz compression support in libdpkg, which
     requires xz >= 5.2.0.
+  * Fix physical file offset comparison in dpkg. Closes: #808912
+    Thanks to Yuri Gribov <tetra2005 at gmail.com>.
   * Test suite:
     - Improve perl code test coverage.
   * Build system:
diff --git a/src/filesdb.c b/src/filesdb.c
index 180f02a..5acb065 100644
--- a/src/filesdb.c
+++ b/src/filesdb.c
@@ -312,8 +312,10 @@ pkg_sorter_by_listfile_phys_offs(const void *a, const void *b)
    * INT_MAX. */
   if (pa->clientdata->listfile_phys_offs < pb->clientdata->listfile_phys_offs)
     return -1;
-  else
+  else if (pa->clientdata->listfile_phys_offs > pb->clientdata->listfile_phys_offs)
     return 1;
+  else
+    return 0;
 }
 
 static void

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list