Package: release.debian.org
User: release.debian....@packages.debian.org
Usertags: pu
Tags: jessie
Severity: normal

Dear stable release managers,

I would like to ask for a p-u upload for apt. The following
bugs will be fixed with that upload:

  * parse specific-arch dependencies correctly on single-arch systems
    (Closes: 777760)
  * remove "first package seen is native package" assumption.
    Thanks to Axel Beckert for testing (Closes: 782777)
  * Fix endless loop in apt-get update that can cause disk
    fillup (LP: #1445239)

The code diff is attached. The fixes were also uploaded to sid some
days ago.

Thanks for your consideration,
 David & Michael

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
    APT policy: (500, 'unstable')
    Architecture: amd64 (x86_64)
    
diff -Nru apt-1.0.9.8/apt-pkg/pkgcache.cc apt-1.0.9.8.1/apt-pkg/pkgcache.cc
--- apt-1.0.9.8/apt-pkg/pkgcache.cc     2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/apt-pkg/pkgcache.cc   2015-05-28 11:08:42.000000000 +0200
@@ -230,12 +230,7 @@
 pkgCache::PkgIterator pkgCache::FindPkg(const string &Name) {
        size_t const found = Name.find(':');
        if (found == string::npos)
-       {
-               if (MultiArchCache() == false)
-                       return SingleArchFindPkg(Name);
-               else
-                       return FindPkg(Name, "native");
-       }
+          return FindPkg(Name, "native");
        string const Arch = Name.substr(found+1);
        /* Beware: This is specialcased to handle pkg:any in dependencies as
           these are linked to virtual pkg:any named packages with all archs.
@@ -249,13 +244,6 @@
 // ---------------------------------------------------------------------
 /* Returns 0 on error, pointer to the package otherwise */
 pkgCache::PkgIterator pkgCache::FindPkg(const string &Name, string const 
&Arch) {
-       if (MultiArchCache() == false && Arch != "none") {
-               if (Arch == "native" || Arch == "all" || Arch == "any" ||
-                   Arch == NativeArch())
-                       return SingleArchFindPkg(Name);
-               else
-                       return PkgIterator(*this,0);
-       }
        /* We make a detour via the GrpIterator here as
           on a multi-arch environment a group is easier to
           find than a package (less entries in the buckets) */
diff -Nru apt-1.0.9.8/apt-pkg/pkgcache.h apt-1.0.9.8.1/apt-pkg/pkgcache.h
--- apt-1.0.9.8/apt-pkg/pkgcache.h      2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/apt-pkg/pkgcache.h    2015-05-28 11:08:42.000000000 +0200
@@ -218,7 +218,7 @@
 
 private:
    bool MultiArchEnabled;
-   PkgIterator SingleArchFindPkg(const std::string &Name);
+   APT_DEPRECATED PkgIterator SingleArchFindPkg(const std::string &Name);
 };
                                                                        /*}}}*/
 // Header structure                                                    /*{{{*/
diff -Nru apt-1.0.9.8/configure apt-1.0.9.8.1/configure
--- apt-1.0.9.8/configure       2015-04-13 18:47:50.000000000 +0200
+++ apt-1.0.9.8.1/configure     2015-05-28 11:10:56.000000000 +0200
@@ -2436,7 +2436,7 @@
 
 
 PACKAGE="apt"
-PACKAGE_VERSION="1.0.9.8"
+PACKAGE_VERSION="1.0.9.8.1"
 PACKAGE_MAIL="APT Development Team <de...@lists.debian.org>"
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE "$PACKAGE"
diff -Nru apt-1.0.9.8/configure.ac apt-1.0.9.8.1/configure.ac
--- apt-1.0.9.8/configure.ac    2015-04-13 18:47:48.000000000 +0200
+++ apt-1.0.9.8.1/configure.ac  2015-05-28 11:10:55.000000000 +0200
@@ -18,7 +18,7 @@
 AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in 
include/apti18n.h:buildlib/apti18n.h.in)
 
 PACKAGE="apt"
-PACKAGE_VERSION="1.0.9.8"
+PACKAGE_VERSION="1.0.9.8.1"
 PACKAGE_MAIL="APT Development Team <de...@lists.debian.org>"
 AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
 AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
diff -Nru apt-1.0.9.8/debian/changelog apt-1.0.9.8.1/debian/changelog
--- apt-1.0.9.8/debian/changelog        2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/debian/changelog      2015-05-28 11:08:42.000000000 +0200
@@ -1,3 +1,16 @@
+apt (1.0.9.8.1) stable; urgency=medium
+
+  [ Michael Vogt ]
+  * Fix endless loop in apt-get update that can cause disk fillup (LP: 
#1445239)
+
+  [ David Kalnischkies ]
+  * parse specific-arch dependencies correctly on single-arch systems
+    (Closes: 777760)
+  * remove "first package seen is native package" assumption.
+    Thanks to Axel Beckert for testing (Closes: 782777)
+
+ -- Michael Vogt <m...@debian.org>  Thu, 28 May 2015 11:07:45 +0200
+
 apt (1.0.9.8) unstable; urgency=medium
 
   [ David Kalnischkies ]
diff -Nru apt-1.0.9.8/debian/gbp.conf apt-1.0.9.8.1/debian/gbp.conf
--- apt-1.0.9.8/debian/gbp.conf 2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/debian/gbp.conf       2015-05-28 11:08:42.000000000 +0200
@@ -1,7 +1,7 @@
 [DEFAULT]
 prebuild = ./prepare-release pre-export
 postbuild = ./prepare-release post-build
-debian-branch = debian/sid
+debian-branch = debian/jessie
 debian-tag = %(version)s
 export-dir = ../build-area
-sign-tags = True
\ No newline at end of file
+sign-tags = True
diff -Nru apt-1.0.9.8/doc/apt-verbatim.ent apt-1.0.9.8.1/doc/apt-verbatim.ent
--- apt-1.0.9.8/doc/apt-verbatim.ent    2015-04-13 18:47:48.000000000 +0200
+++ apt-1.0.9.8.1/doc/apt-verbatim.ent  2015-05-28 11:10:55.000000000 +0200
@@ -225,7 +225,7 @@
 ">
 
 <!-- this will be updated by 'prepare-release' -->
-<!ENTITY apt-product-version "1.0.9.8">
+<!ENTITY apt-product-version "1.0.9.8.1">
 
 <!-- (Code)names for various things used all over the place -->
 <!ENTITY oldstable-codename "wheezy">
diff -Nru apt-1.0.9.8/methods/http.cc apt-1.0.9.8.1/methods/http.cc
--- apt-1.0.9.8/methods/http.cc 2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/methods/http.cc       2015-05-28 11:08:42.000000000 +0200
@@ -443,7 +443,7 @@
       else if (JunkSize != 0)
         In.Limit(JunkSize);
       else
-        In.Limit(Size - StartPos);
+        In.Limit(DownloadSize);
       
       // Just transfer the whole block.
       do
diff -Nru apt-1.0.9.8/methods/server.cc apt-1.0.9.8.1/methods/server.cc
--- apt-1.0.9.8/methods/server.cc       2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/methods/server.cc     2015-05-28 11:08:42.000000000 +0200
@@ -164,15 +164,22 @@
         Encoding = Stream;
       HaveContent = true;
 
-      unsigned long long * SizePtr = &Size;
+      unsigned long long * DownloadSizePtr = &DownloadSize;
       if (Result == 416)
-        SizePtr = &JunkSize;
+        DownloadSizePtr = &JunkSize;
 
-      *SizePtr = strtoull(Val.c_str(), NULL, 10);
-      if (*SizePtr >= std::numeric_limits<unsigned long long>::max())
+      *DownloadSizePtr = strtoull(Val.c_str(), NULL, 10);
+      if (*DownloadSizePtr >= std::numeric_limits<unsigned long long>::max())
         return _error->Errno("HeaderLine", _("The HTTP server sent an invalid 
Content-Length header"));
-      else if (*SizePtr == 0)
+      else if (*DownloadSizePtr == 0)
         HaveContent = false;
+
+      // On partial content (206) the Content-Length less than the real
+      // size, so do not set it here but leave that to the Content-Range
+      // header instead
+      if(Result != 206 && Size == 0)
+         Size = DownloadSize;
+
       return true;
    }
 
@@ -193,6 +200,9 @@
         return _error->Error(_("The HTTP server sent an invalid Content-Range 
header"));
       if ((unsigned long long)StartPos > Size)
         return _error->Error(_("This HTTP server has broken range support"));
+
+      // figure out what we will download
+      DownloadSize = Size - StartPos;
       return true;
    }
 
diff -Nru apt-1.0.9.8/methods/server.h apt-1.0.9.8.1/methods/server.h
--- apt-1.0.9.8/methods/server.h        2015-04-13 07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/methods/server.h      2015-05-28 11:08:42.000000000 +0200
@@ -34,7 +34,8 @@
    char Code[360];
 
    // These are some statistics from the last parsed header lines
-   unsigned long long Size; // size of the usable content (aka: the file)
+   unsigned long long Size; // total size of the usable content (aka: the file)
+   unsigned long long DownloadSize; // size we actually download (can be 
smaller than Size if we have partial content)
    unsigned long long JunkSize; // size of junk content (aka: server error 
pages)
    unsigned long long StartPos;
    time_t Date;
diff -Nru apt-1.0.9.8/test/integration/test-bug-782777-single-arch-weirdness 
apt-1.0.9.8.1/test/integration/test-bug-782777-single-arch-weirdness
--- apt-1.0.9.8/test/integration/test-bug-782777-single-arch-weirdness  
1970-01-01 01:00:00.000000000 +0100
+++ apt-1.0.9.8.1/test/integration/test-bug-782777-single-arch-weirdness        
2015-05-28 11:08:42.000000000 +0200
@@ -0,0 +1,72 @@
+#!/bin/sh
+# Ensure that the order in which packages are in the binary cache
+# does not effect if they can be found or not
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'i386'
+
+insertpackage 'unstable' 'abar' 'i386' '1'
+insertpackage 'unstable' 'foobar' 'i386' '1' 'Depends: abar:amd64, zfoo:amd64'
+insertpackage 'unstable' 'zfoo' 'i386' '1'
+
+setupaptarchive
+
+testrun() {
+       rm -f rootdir/var/lib/apt/extended_states
+
+       testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar zfoo -s
+
+       testequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+  abar zfoo
+0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
+Inst abar (1 unstable [i386])
+Inst zfoo (1 unstable [i386])
+Conf abar (1 unstable [i386])
+Conf zfoo (1 unstable [i386])' aptget install abar:i386 zfoo:i386 -s
+
+       testequal "Reading package lists...
+Building dependency tree...
+Package abar:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+Package zfoo:amd64 is not available, but is referred to by another package.
+This may mean that the package is missing, has been obsoleted, or
+is only available from another source
+
+E: Package 'abar:amd64' has no installation candidate
+E: Package 'zfoo:amd64' has no installation candidate" aptget install 
abar:amd64 zfoo:amd64 -s
+
+       cp -f rootdir/var/lib/dpkg/status status.backup
+       insertinstalledpackage 'abar' 'i386' '1'
+       insertinstalledpackage 'zfoo' 'i386' '1'
+
+       testequal 'abar
+zfoo' aptmark showmanual abar zfoo
+       testequal 'abar set to automatically installed.
+zfoo set to automatically installed.' aptmark auto abar zfoo
+       testempty aptmark showmanual abar zfoo
+       testequal 'abar
+zfoo' aptmark showauto abar zfoo
+
+       mv -f status.backup rootdir/var/lib/dpkg/status
+}
+
+msgmsg 'Single-Arch testrun'
+testrun
+msgmsg 'Multi-Arch testrun'
+configarchitecture 'i386' 'amd64'
+testrun
diff -Nru apt-1.0.9.8/test/integration/test-bug-lp1445239-download-loop 
apt-1.0.9.8.1/test/integration/test-bug-lp1445239-download-loop
--- apt-1.0.9.8/test/integration/test-bug-lp1445239-download-loop       
1970-01-01 01:00:00.000000000 +0100
+++ apt-1.0.9.8.1/test/integration/test-bug-lp1445239-download-loop     
2015-05-28 11:08:42.000000000 +0200
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# this is a regression test for LP: #1445239 where a partial download can
+# trigger an endless hang of the download method
+#
+
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+setupenvironment
+configarchitecture 'amd64'
+
+changetowebserver
+webserverconfig 'aptwebserver::support::range' 'true'
+
+TESTFILE='aptarchive/testfile'
+dd if=/dev/zero of=$TESTFILE bs=100k count=1 2>/dev/null
+
+DOWNLOADLOG='rootdir/tmp/testdownloadfile.log'
+
+TARGET=testfile-downloaded
+dd if=/dev/zero of=$TARGET bs=99k count=1 2>/dev/null
+if ! downloadfile http://localhost:8080/testfile "$TARGET" > "$DOWNLOADLOG"; 
then
+    cat >&2 "$DOWNLOADLOG"
+    msgfail
+else
+    msgpass
+fi
diff -Nru apt-1.0.9.8/test/interactive-helper/aptwebserver.cc 
apt-1.0.9.8.1/test/interactive-helper/aptwebserver.cc
--- apt-1.0.9.8/test/interactive-helper/aptwebserver.cc 2015-04-13 
07:25:06.000000000 +0200
+++ apt-1.0.9.8.1/test/interactive-helper/aptwebserver.cc       2015-05-28 
11:08:42.000000000 +0200
@@ -654,13 +654,15 @@
                     if (filesize > filestart)
                     {
                        data.Skip(filestart);
-                       std::ostringstream contentlength;
-                       contentlength << "Content-Length: " << (filesize - 
filestart);
-                       headers.push_back(contentlength.str());
+                        // make sure to send content-range before conent-length
+                        // as regression test for LP: #1445239
                        std::ostringstream contentrange;
                        contentrange << "Content-Range: bytes " << filestart << 
"-"
                           << filesize - 1 << "/" << filesize;
                        headers.push_back(contentrange.str());
+                       std::ostringstream contentlength;
+                       contentlength << "Content-Length: " << (filesize - 
filestart);
+                       headers.push_back(contentlength.str());
                        sendHead(client, 206, headers);
                        if (sendContent == true)
                           sendFile(client, headers, data);

Reply via email to