]> git.saurik.com Git - apt.git/commitdiff
pkgTagFile: if we have seen the end, do not try to see more
authorDavid Kalnischkies <david@kalnischkies.de>
Wed, 29 Jan 2014 22:02:51 +0000 (23:02 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Wed, 29 Jan 2014 23:16:19 +0000 (00:16 +0100)
Asking for more via Step() will notice that we are done with the file
already and will result in a fail, which means we can't find the last
sections anymore (which is especially painful if we haven't moved at
all as in the testcase we haven't even looked at one of the sources
leading to a strange behaviour)

Reported-By: Niall Walsh <niallwalsh@users.berlios.de>
apt-pkg/tagfile.cc
test/integration/test-apt-get-source-multisources [new file with mode: 0755]

index b92b2c15ab86674fff11e94545e50b2c7f3fc759..832a40d1ea35fc60b517784198c9b407839db7bd 100644 (file)
@@ -207,7 +207,11 @@ bool pkgTagFile::Jump(pkgTagSection &Tag,unsigned long long Offset)
       unsigned long long Dist = Offset - d->iOffset;
       d->Start += Dist;
       d->iOffset += Dist;
-      return Step(Tag);
+      // if we have seen the end, don't ask for more
+      if (d->Done == true)
+        return Tag.Scan(d->Start, d->End - d->Start);
+      else
+        return Step(Tag);
    }
 
    // Reposition and reload..
diff --git a/test/integration/test-apt-get-source-multisources b/test/integration/test-apt-get-source-multisources
new file mode 100755 (executable)
index 0000000..cc759e8
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'armhf'
+
+insertsource 'unstable' 'adduser' 'all' '3.113+nmu3'
+insertsource 'stable' 'python-fll' 'all' '0.9.11'
+
+insertpackage 'unstable' 'adduser' 'all' '3.113+nmu3'
+insertpackage 'stable' 'python-fll' 'all' '0.9.11'
+
+setupaptarchive
+
+APTARCHIVE=$(readlink -f ./aptarchive)
+
+HEADER="Reading package lists...
+Building dependency tree..."
+testequal "$HEADER
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e" aptget source -qdy --print-uris --dsc-only adduser=3.113 python-fll=0.9.11
+
+testequal "$HEADER
+Need to get 0 B of source archives.
+'file://${APTARCHIVE}/python-fll_0.9.11.dsc' python-fll_0.9.11.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e
+'file://${APTARCHIVE}/adduser_3.113+nmu3.dsc' adduser_3.113+nmu3.dsc 0 MD5Sum:d41d8cd98f00b204e9800998ecf8427e"  aptget source -qdy --print-uris --dsc-only python-fll=0.9.11 adduser=3.113