summaryrefslogtreecommitdiffstats
path: root/test/integration/test-apt-translation-has-no-packages
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 06:14:41 +0000
commit549a391d6438e828001eeeaf235b080c054a7bf3 (patch)
tree1bb6b1ea5987fa167a1d13abe82209cc882dd94b /test/integration/test-apt-translation-has-no-packages
parentInitial commit. (diff)
downloadapt-549a391d6438e828001eeeaf235b080c054a7bf3.tar.xz
apt-549a391d6438e828001eeeaf235b080c054a7bf3.zip
Adding upstream version 2.2.4.upstream/2.2.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-apt-translation-has-no-packages')
-rwxr-xr-xtest/integration/test-apt-translation-has-no-packages35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/integration/test-apt-translation-has-no-packages b/test/integration/test-apt-translation-has-no-packages
new file mode 100755
index 0000000..3c07af3
--- /dev/null
+++ b/test/integration/test-apt-translation-has-no-packages
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Due to corruption (local or network) a user might end up with a
+# Translation-$lang file on disk that is actually a Packages file. In this
+# case apt used to generate invalid package versions out of the
+# Translation-$lang file (i.e. apt-cache policy foo) would show a version
+# coming out of a Translation file. Downloading this versions fails as
+# there is no acquire method available for the package
+#
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture "amd64"
+
+buildsimplenativepackage 'foo' 'all' '1.0'
+setupaptarchive
+
+APTARCHIVE="$(readlink -f ./aptarchive)"
+
+# corrupt the Translation-en file to look like a regular Packages file
+rm rootdir/var/cache/apt/*.bin
+cp "$APTARCHIVE/dists/unstable/main/binary-amd64/Packages" \
+ rootdir/var/lib/apt/lists/*Translation-en
+
+# ensure that there is no Version for the package foo generated out of
+# the corrupted Translation-en file
+testsuccessequal "foo:
+ Installed: (none)
+ Candidate: 1.0
+ Version table:
+ 1.0 500
+ 500 file:$APTARCHIVE unstable/main all Packages" aptcache policy foo