summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-03-21 08:14:15 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2020-03-21 08:35:26 +0100
commitbf46e09f0e4b52b3c71ac20bb11e7511fc16179f (patch)
tree192791c29a23a3e144d346798d4058752b6d97a7 /test
parent429effb963fba7529b8ff57d6b0474916d4fed69 (diff)
Parse last line in deb file correctly by adding a newline
While merging apt-pkg and apt-inst libraries the codepath of handling deb files in apt-pkg was adapted to use the 'old' code from apt-inst instead of fork&exec of dpkg-deb -I. The information we get this way forms the main part of the package stanza, but we add a few semi-optional fields to the stanza to make it look and work more like a stanza we got from a repository. Just be careful with the area where these two parts touch as if, hypothetically, we would stip all newlines around the parts, but forget to add a newline between them later, the two lines around the merge would stick a bit too close together forming one which could result in fun parsing errors if this merged line was previously e.g. a well-formed Depends line and has now extra fluff attached. This codepath has a history with too many newlines (#802553) though, so how likely is it really that it will some day lack one you may ask. References: 6089a4b17c61ef30b2efc00e270b0907f51f352a
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-apt-get-install-deb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb
index 002c1aef8..7fa5ca3e7 100755
--- a/test/integration/test-apt-get-install-deb
+++ b/test/integration/test-apt-get-install-deb
@@ -168,12 +168,16 @@ createpkg 'trailing-newline' '' '
createpkg 'double-trailing-newline' '' '
'
+createpkg 'last-line-parse' '' 'Pre-Depends: pkg-as-it-should-be
+'
echo 'Package: /pkg-/
Pin: release a=experimental
Pin-Priority: 501' > rootdir/etc/apt/preferences.d/pinit
+testfailuremsg 'E: Unable to correct problems, you have held broken packages.' aptget install -q=0 ./incoming/pkg-last-line-parse_0_all.deb
testsuccess aptget install ./incoming/pkg-as-it-should-be_0_all.deb
+testsuccess aptget install ./incoming/pkg-last-line-parse_0_all.deb
testsuccess aptget install "$(readlink -f ./incoming/pkg-leading-newline_0_all.deb)"
testsuccess aptget install ./incoming/pkg-trailing-newline_0_all.deb
testsuccess aptget install ./incoming/pkg-double-trailing-newline_0_all.deb