summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/create-test-data49
-rw-r--r--test/integration/framework13
-rwxr-xr-xtest/integration/skip-apt-download-progress (renamed from test/integration/test-apt-download-progress)0
-rwxr-xr-xtest/integration/test-acquire-binary-all4
-rwxr-xr-xtest/integration/test-apt-get-update-unauth-warning5
-rwxr-xr-xtest/integration/test-apt-helper17
-rwxr-xr-xtest/integration/test-apt-https-no-redirect19
-rwxr-xr-xtest/integration/test-apt-key13
-rwxr-xr-xtest/integration/test-apt-update-disappeared-component45
-rwxr-xr-xtest/integration/test-apt-update-failure-propagation25
-rwxr-xr-xtest/integration/test-apt-update-releaseinfo-changes80
-rwxr-xr-xtest/integration/test-bug-602412-dequote-redirect4
-rwxr-xr-xtest/integration/test-bug-717891-abolute-uris-for-proxies27
-rwxr-xr-xtest/integration/test-bug-738785-switch-protocol2
-rwxr-xr-xtest/integration/test-bug-838779-untrusted-to-trusted-Release-hit6
-rwxr-xr-xtest/integration/test-bug-841874-warning-for-mismatching-distribution12
-rwxr-xr-xtest/integration/test-dpkg-normalization44
-rwxr-xr-xtest/integration/test-handle-redirect-as-used-mirror-change3
-rwxr-xr-xtest/integration/test-pdiff-usage4
-rwxr-xr-xtest/integration/test-policy-pinning2
-rwxr-xr-xtest/integration/test-ubuntu-bug-346386-apt-get-update-paywall9
-rw-r--r--test/interactive-helper/aptwebserver.cc7
-rw-r--r--test/interactive-helper/extract-control.cc2
-rw-r--r--test/interactive-helper/rpmver.cc6
-rw-r--r--test/interactive-helper/teestream.h2
-rw-r--r--test/interactive-helper/test_fileutl.cc8
-rw-r--r--test/interactive-helper/test_udevcdrom.cc6
-rw-r--r--test/interactive-helper/testdeb.cc4
-rw-r--r--test/libapt/acqprogress_test.cc8
-rw-r--r--test/libapt/cdrom_test.cc4
-rw-r--r--test/libapt/cdromfindpackages_test.cc2
-rw-r--r--test/libapt/compareversion_test.cc4
-rw-r--r--test/libapt/extracttar_test.cc2
-rw-r--r--test/libapt/file-helpers.cc4
-rw-r--r--test/libapt/fileutl_test.cc8
-rw-r--r--test/libapt/getlanguages_test.cc4
-rw-r--r--test/libapt/getlistoffilesindir_test.cc4
-rw-r--r--test/libapt/globalerror_test.cc2
-rw-r--r--test/libapt/gtest_runner.cc2
-rw-r--r--test/libapt/hashsums_test.cc6
-rw-r--r--test/libapt/indexcopytosourcelist_test.cc2
-rw-r--r--test/libapt/parsedepends_test.cc4
-rw-r--r--test/libapt/priority_test.cc2
-rw-r--r--test/libapt/sourcelist_test.cc2
-rw-r--r--test/libapt/srvrecs_test.cc2
-rw-r--r--test/libapt/strutil_test.cc2
-rw-r--r--test/libapt/tagfile_test.cc2
-rw-r--r--test/libapt/tagsection_test.cc2
-rw-r--r--test/libapt/teestream_test.cc6
-rw-r--r--test/libapt/uri_test.cc2
50 files changed, 363 insertions, 131 deletions
diff --git a/test/integration/create-test-data b/test/integration/create-test-data
index 7040aaed7..eff2ba530 100755
--- a/test/integration/create-test-data
+++ b/test/integration/create-test-data
@@ -6,42 +6,55 @@ if [ -z "$1" -o -z "$2" ]; then
exit 1
fi
+CHECK_ARGS='no'
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
-BUILDDIRECTORY="${TESTDIR}/../../build/bin"
+find_project_binary_dir
+BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}"
-GENERATE=$1
-CODENAME=$2
+GENERATE="$1"
+CODENAME="$2"
shift 2
-WORKDIR=$(mktemp -d)
-trap "rm -rf $WORKDIR" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
-touch $WORKDIR/status
-TMPGEN=$WORKDIR/Packages
-export LANG=C
-
-LISTOFPKGS=$(aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0 2> /dev/null | awk '/^Inst/ {print $2}' | sed -e "s#\$#/$CODENAME#")
+WORKDIR="$(mktemp -d)"
+cleanupworkdir() {
+ if [ -z "$WORKDIR" ]; then return; fi
+ rm -rf "$WORKDIR"
+}
+trap "cleanupworkdir;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+touch "$WORKDIR/status"
+TMPGEN="$WORKDIR/Packages"
+export LANG=C.UTF-8
+
+aptgetinstall() {
+ aptget install "$@" --no-install-recommends -t "$CODENAME" -s \
+ -o Dir::state::status="$WORKDIR/status" \
+ -o Dir::Cache="$WORKDIR" \
+ -o pkgCacheGen::Essential=none \
+ -o APT::Immediate-Configure=0
+}
+LISTOFPKGS="$(aptgetinstall "$@" 2> /dev/null | awk '/^Inst/ {print $2}' | sed -e "s#\$#/$CODENAME#")"
if [ -z "$LISTOFPKGS" ]; then
echo "List of packages is empty: run apt-get install command again for you now"
- aptget install $* -t $CODENAME -so Dir::state::status=$WORKDIR/status -o Dir::Cache::archives=$WORKDIR -o pkgCacheGen::Essential=none -o APT::Immediate-Configure=0
+ aptgetinstall
exit 1
fi
-aptcache show $LISTOFPKGS --no-all-versions 2> $WORKDIR/error.lst > $TMPGEN
-sed -i $TMPGEN \
- -e '/^ / d' \
+aptcache show $LISTOFPKGS --no-all-versions 2> "$WORKDIR/error.lst" | sed -e '/^ / d' \
-e '/^SHA1: / d' -e '/^SHA256: / d' \
-e '/^Homepage: / d' -e '/^Tag: / d' \
-e '/^Xul-Appid: / d' \
- -e '/^Status: / d'
+ -e '/^Status: / d' \
+ -e 's/^Description-en:/Description:/' \
+ > "$TMPGEN"
if [ "$CODENAME" = "experimental" ]; then
- aptcache show $(cat $WORKDIR/error.lst | cut -d"'" -f 4 | sed -e 's#$#/sid#') --no-all-versions 2> /dev/null >> $TMPGEN
+ aptcache show $(cut -d"'" -f 4 "$WORKDIR/error.lst" | sed -e 's#$#/sid#') --no-all-versions 2> /dev/null >> "$TMPGEN"
fi
if echo "$GENERATE" | grep '^status-' > /dev/null; then
- sed -i $TMPGEN -e '/^Package: / a\
+ sed -i "$TMPGEN" -e '/^Package: / a\
Status: install ok installed' \
-e '/^Filename: / d' -e '/^Size: / d' -e '/^MD5sum: / d'
fi
-apt-sortpkgs $TMPGEN > $GENERATE
+apt-sortpkgs "$TMPGEN" > "$GENERATE"
diff --git a/test/integration/framework b/test/integration/framework
index c65ac5acb..12c80b96c 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -2,7 +2,7 @@
EXIT_CODE=0
-while [ -n "$1" ]; do
+while [ -n "$1" -a -z "$CHECK_ARGS" ]; do
if [ "$1" = "-q" ]; then
export MSGLEVEL=2
elif [ "$1" = "-qq" ]; then
@@ -1161,7 +1161,7 @@ setupaptarchive() {
killgpgagent() {
if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi
local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome"
- if [ -e "${GPGHOME}" ]; then return; fi
+ if [ ! -e "${GPGHOME}" ]; then return; fi
# ensure the agent dies quickly as different versions have different suicide heuristics
GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true
rm -rf "$GPGHOME"
@@ -1428,12 +1428,12 @@ checkdiff() {
local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp"
touch "$TMPFILE1" "$TMPFILE2"
if [ "$1" != '-' ]; then
- sed -e '/^profiling:/ d' < "$1" >"$TMPFILE1"
+ sed -e '/^profiling:/ d' -e '/\.\.\.profiling:/{N;s#\.\.\.profiling:.*\n#...#g}' < "$1" >"$TMPFILE1"
else
TMPFILE1='-'
fi
if [ "$2" != '-' ]; then
- sed -e '/^profiling:/ d' < "$2" >"$TMPFILE2"
+ sed -e '/^profiling:/ d' -e '/\.\.\.profiling:/{N;s#\.\.\.profiling:.*\n#...#g}' < "$2" >"$TMPFILE2"
else
TMPFILE2='-'
fi
@@ -2059,10 +2059,12 @@ aptautotest_aptget_update() {
if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755"
+ (
+ cd /
# all copied files are properly chmodded
local backupIFS="$IFS"
IFS="$(printf "\n\b")"
- for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock'); do
+ find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | while read file; do
testfilestats "$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644"
done
IFS="$backupIFS"
@@ -2074,6 +2076,7 @@ aptautotest_aptget_update() {
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \
"$(find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)"
fi
+ )
}
aptautotest_apt_update() { aptautotest_aptget_update "$@"; }
aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; }
diff --git a/test/integration/test-apt-download-progress b/test/integration/skip-apt-download-progress
index 13a18f7c3..13a18f7c3 100755
--- a/test/integration/test-apt-download-progress
+++ b/test/integration/skip-apt-download-progress
diff --git a/test/integration/test-acquire-binary-all b/test/integration/test-acquire-binary-all
index ba47eddc2..379348e3f 100755
--- a/test/integration/test-acquire-binary-all
+++ b/test/integration/test-acquire-binary-all
@@ -114,9 +114,9 @@ testsuccess grep '^Get.* all Contents ' aptupdate.output
testequal 'foo-1
foo-2' aptcache pkgnames foo-
-# apt doesn't know supported archs, so missing a configured arch is a failure
+# apt doesn't know supported archs, so missing a configured arch is a problem
configarchitecture 'amd64' 'i386'
-testfailure apt update
+testwarningmsg "W: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'file:$(readlink -f ./aptarchive) unstable InRelease' does not seem to provide it (sources.list entry misspelt?)" apt update
testequal 'foo-1
foo-2' aptcache pkgnames foo-
diff --git a/test/integration/test-apt-get-update-unauth-warning b/test/integration/test-apt-get-update-unauth-warning
index 093478b9e..616e0234c 100755
--- a/test/integration/test-apt-get-update-unauth-warning
+++ b/test/integration/test-apt-get-update-unauth-warning
@@ -21,7 +21,8 @@ setupaptarchive --no-update
APTARCHIVE="$(readlink -f ./aptarchive)"
find "$APTARCHIVE/dists/unstable" \( -name 'InRelease' -o -name 'Release.gpg' \) -delete
sed -i -n '/^SHA1:$/q;p' "${APTARCHIVE}/dists/unstable/Release"
-testwarning aptget update
+testfailure aptget update
+testwarning aptget update --allow-insecure-repositories
rm -rf rootdir/var/lib/apt/lists
@@ -35,7 +36,7 @@ Err:2 file:$APTARCHIVE unstable Release
Reading package lists...
E: The repository 'file:$APTARCHIVE unstable Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
-N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update --no-allow-insecure-repositories
+N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update
# no package foo
testsuccessequal 'Listing...' apt list foo
diff --git a/test/integration/test-apt-helper b/test/integration/test-apt-helper
index 5e4a96fbd..fda28968f 100755
--- a/test/integration/test-apt-helper
+++ b/test/integration/test-apt-helper
@@ -79,11 +79,11 @@ setupproxydetect() {
echo "$@"
} > "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
chmod 755 "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
- echo "Acquire::${METH}::Proxy-Auto-Detect \"${TMPWORKINGDIRECTORY}/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
+ echo "Acquire::${METH}::${CONFNAME} \"${TMPWORKINGDIRECTORY}/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
}
test_apt_helper_detect_proxy() {
- msgmsg 'apt-helper auto-detect-proxy' 'no proxy'
+ msgmsg "apt-helper $CONFNAME" 'no proxy'
testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
setupproxydetect 'http' 'exit 0'
testsuccessequal "Using proxy '' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
@@ -94,19 +94,26 @@ test_apt_helper_detect_proxy() {
W: ProxyAutoDetect command returned an empty line" apthelper auto-detect-proxy http://example.com/
setupproxydetect 'http' 'echo DIRECT'
testsuccessequal "Using proxy 'DIRECT' for URL 'http://example.com/'" apthelper auto-detect-proxy http://example.com/
+ chmod -x "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
+ testfailureequal "E: ProxyAutoDetect command '${TMPWORKINGDIRECTORY}/apt-proxy-detect' can not be executed! - access (13: Permission denied)" apthelper auto-detect-proxy http://example.com/
- msgmsg 'apt-helper auto-detect-proxy' 'http proxy'
+ msgmsg "apt-helper $CONFNAME" 'http proxy'
setupproxydetect 'http' 'echo "http://some-proxy"'
testsuccessequal "Using proxy 'http://some-proxy' for URL 'http://www.example.com/'" apthelper auto-detect-proxy http://www.example.com
+ testsuccessequal "Using proxy '' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com
- msgmsg 'apt-helper auto-detect-proxy' 'https proxy'
+ msgmsg "apt-helper $CONFNAME" 'https proxy'
setupproxydetect 'https' 'echo "https://https-proxy"'
+ testsuccessequal "Using proxy '' for URL 'http://no-ssl.example.com/'" apthelper auto-detect-proxy http://no-ssl.example.com
testsuccessequal "Using proxy 'https://https-proxy' for URL 'https://ssl.example.com/'" apthelper auto-detect-proxy https://ssl.example.com
+ rm -f rootdir/etc/apt/apt.conf.d/02proxy-detect "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
}
test_apt_helper_download "http://localhost:${APTHTTPPORT}"
test_apt_helper_download "https://localhost:${APTHTTPSPORT}"
-test_apt_helper_detect_proxy
+for CONFNAME in 'ProxyAutoDetect' 'Proxy-Auto-Detect' ; do
+ test_apt_helper_detect_proxy
+done
msgmsg 'test various failure modes'
testfailureequal 'E: Invalid operation download' apthelper download
testfailureequal 'E: Must specify at least one pair url/filename' apthelper download-file
diff --git a/test/integration/test-apt-https-no-redirect b/test/integration/test-apt-https-no-redirect
index d6c630d5f..1c388098b 100755
--- a/test/integration/test-apt-https-no-redirect
+++ b/test/integration/test-apt-https-no-redirect
@@ -14,7 +14,8 @@ echo 'alright' > aptarchive/working
changetohttpswebserver
webserverconfig 'aptwebserver::redirect::replace::/redirectme/' "http://localhost:${APTHTTPPORT}/"
webserverconfig 'aptwebserver::redirect::replace::/redirectme2/' "https://localhost:${APTHTTPSPORT}/"
-echo 'Dir::Bin::Methods::https+http "https";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method
+echo 'Dir::Bin::Methods::https+http "http";' > rootdir/etc/apt/apt.conf.d/99add-https-http-method
+echo 'Dir::Bin::Methods::foo+https "http";' > rootdir/etc/apt/apt.conf.d/99add-foo-https-method
msgtest 'download of a file works via' 'http'
testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
@@ -26,20 +27,22 @@ testfileequal httpsfile 'alright'
rm -f httpfile httpsfile
msgtest 'download of http file works via' 'https+http'
-testsuccess --nomsg downloadfile "http://localhost:${APTHTTPPORT}/working" httpfile
+testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/working" httpfile
testfileequal httpfile 'alright'
-
-msgtest 'download of https file works via' 'https+http'
-testsuccess --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/working" httpsfile
-testfileequal httpsfile 'alright'
-rm -f httpfile httpsfile
+rm -f httpfile
msgtest 'download of a file does not work if' 'https redirected to http'
testfailure --nomsg downloadfile "https://localhost:${APTHTTPSPORT}/redirectme/working" redirectfile
-
msgtest 'libcurl has forbidden access in last request to' 'http resource'
testsuccess --nomsg grep -q -E -- "Redirection from https to 'http://.*' is forbidden" rootdir/tmp/testfailure.output
+rm -f redirectfile
msgtest 'download of a file does work if' 'https+http redirected to https'
testsuccess --nomsg downloadfile "https+http://localhost:${APTHTTPPORT}/redirectme2/working" redirectfile
testfileequal redirectfile 'alright'
+rm -f redirectfile
+
+msgtest 'download of a file does work if' 'foo+https redirected to https'
+testsuccess --nomsg downloadfile "foo+https://localhost:${APTHTTPSPORT}/redirectme2/working" redirectfile
+testfileequal redirectfile 'alright'
+rm -f redirectfile
diff --git a/test/integration/test-apt-key b/test/integration/test-apt-key
index 4fd1510a2..13afff995 100755
--- a/test/integration/test-apt-key
+++ b/test/integration/test-apt-key
@@ -12,8 +12,13 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
+chmod o+x "${TMPWORKINGDIRECTORY}/.."
configarchitecture 'amd64'
+insertpackage 'unstable' 'bar' 'i386' '1'
+insertsource 'unstable' 'foo' 'all' '1'
+setupaptarchive --no-update
+
# start from a clean plate again
cleanplate() {
rm -rf "${ROOTDIR}/etc/apt/trusted.gpg.d/" "${ROOTDIR}/etc/apt/trusted.gpg"
@@ -249,6 +254,10 @@ gpg: unchanged: 1' aptkey --fakeroot update
chmod 000 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}"
testwarning --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}"
testwarning aptkey list
+ # check that apt users see warnings, too
+ rm -rf "${ROOTDIR}/var/lib/apt/lists"
+ testwarning apt update
+
chmod 644 "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}"
rm -f "${ROOTDIR}/etc/apt/trusted.gpg.d/unreadablekey.${EXT}"
fi
@@ -275,6 +284,10 @@ gpg: unchanged: 1' aptkey --fakeroot update
msgtest 'Test verify fails on' 'bad file'
testfailure --nomsg aptkey --quiet --readonly verify "${SIGNATURE}.gpg" "${SIGNATURE}2"
+
+ # try to perform an entire update with this gpgv
+ rm -rf "${ROOTDIR}/var/lib/apt/lists"
+ testsuccess apt update -o Test::Dir="${ROOTDIR}"
done
rm -f "${ROOTDIR}/etc/apt/apt.conf.d/00gpgvcmd"
diff --git a/test/integration/test-apt-update-disappeared-component b/test/integration/test-apt-update-disappeared-component
new file mode 100755
index 000000000..7c7dd7711
--- /dev/null
+++ b/test/integration/test-apt-update-disappeared-component
@@ -0,0 +1,45 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'foobar' 'all' '1'
+
+APTARCHIVE="file:$(readlink -f ./aptarchive) unstable InRelease"
+setupaptarchive --no-update
+sed -i -e 's#main\s*$#main contrib non-free sub/component#' rootdir/etc/apt/sources.list.d/*
+
+# if no Component info is available we assume all are supported, which means
+# that non-existent Packages files are assumed to be missing because they are
+# empty (as the repository is declaring support for them via Architectures)
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'sub/component/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)" apt update
+
+sed -i -e '/^Codename: / a\
+Components: main contrib' $(find ./aptarchive -name 'Release')
+signreleasefiles
+
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'sub/component/source/Sources' as repository '${APTARCHIVE}' doesn't have the component 'sub/component' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-amd64/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-all/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/i18n/Translation-en' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'sub/component/binary-amd64/Packages' as repository '${APTARCHIVE}' doesn't have the component 'sub/component' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'sub/component/binary-all/Packages' as repository '${APTARCHIVE}' doesn't have the component 'sub/component' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'sub/component/i18n/Translation-en' as repository '${APTARCHIVE}' doesn't have the component 'sub/component' (component misspelt in sources.list?)" apt update
+
+# the field looks like this e.g. for security.debian.org sources
+sed -i -e 's#^Components:.*$#Components: updates/main updates/contrib sub/component#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+
+testwarningmsg "W: Skipping acquire of configured file 'contrib/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/source/Sources' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'sub/component/source/Sources' as repository '${APTARCHIVE}' does not seem to provide it (sources.list entry misspelt?)
+W: Skipping acquire of configured file 'non-free/binary-amd64/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/binary-all/Packages' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)
+W: Skipping acquire of configured file 'non-free/i18n/Translation-en' as repository '${APTARCHIVE}' doesn't have the component 'non-free' (component misspelt in sources.list?)" apt update
diff --git a/test/integration/test-apt-update-failure-propagation b/test/integration/test-apt-update-failure-propagation
index 1361b1b93..20d941f7d 100755
--- a/test/integration/test-apt-update-failure-propagation
+++ b/test/integration/test-apt-update-failure-propagation
@@ -47,24 +47,9 @@ mv aptarchive/dists/stable aptarchive/dists/stable.good
testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details." apt update
-testfailure aptget update --no-allow-insecure-repositories
-testequalor2 "Hit:1 http://localhost:${APTHTTPPORT} sid InRelease
-Ign:2 https://localhost:${APTHTTPSPORT} stable InRelease
- 404 Not Found
-Err:3 https://localhost:${APTHTTPSPORT} stable Release
- 404 Not Found
-Reading package lists...
-E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
-N: Updating from such a repository can't be done securely, and is therefore disabled by default.
-N: See apt-secure(8) manpage for repository creation and user configuration details." "Ign:1 https://localhost:${APTHTTPSPORT} stable InRelease
- 404 Not Found
-Err:2 https://localhost:${APTHTTPSPORT} stable Release
- 404 Not Found
-Hit:3 http://localhost:${APTHTTPPORT} sid InRelease
-Reading package lists...
-E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
+testfailuremsg "E: The repository 'https://localhost:${APTHTTPSPORT} stable Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
-N: See apt-secure(8) manpage for repository creation and user configuration details." cat rootdir/tmp/testfailure.output
+N: See apt-secure(8) manpage for repository creation and user configuration details." aptget update
mv aptarchive/dists/stable.good aptarchive/dists/stable
posttest() {
@@ -100,7 +85,13 @@ for FILE in rootdir/etc/apt/sources.list.d/*-stable-* ; do
sed -i -e "s#:${APTHTTPSPORT}/#:666/#" "$FILE"
done
testwarning aptget update -o Dir::Bin::Methods::https="${OLDMETHODS}/https"
+if grep -q FORCE_CURL:BOOL=OFF $PROJECT_BINARY_DIR/CMakeCache.txt; then
+testequalor2 "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused
+W: Some index files failed to download. They have been ignored, or old ones used instead." "W: Failed to fetch https://localhost:666/dists/stable/InRelease Could not connect to localhost:666 (127.0.0.1). - connect (111: Connection refused)
+W: Some index files failed to download. They have been ignored, or old ones used instead." tail -n 2 rootdir/tmp/testwarning.output
+else
testequalor2 "W: Failed to fetch https://localhost:666/dists/stable/InRelease Failed to connect to localhost port 666: Connection refused
W: Some index files failed to download. They have been ignored, or old ones used instead." "W: Failed to fetch https://localhost:666/dists/stable/InRelease couldn't connect to host
W: Some index files failed to download. They have been ignored, or old ones used instead." tail -n 2 rootdir/tmp/testwarning.output
+fi
posttest
diff --git a/test/integration/test-apt-update-releaseinfo-changes b/test/integration/test-apt-update-releaseinfo-changes
new file mode 100755
index 000000000..e4bca3658
--- /dev/null
+++ b/test/integration/test-apt-update-releaseinfo-changes
@@ -0,0 +1,80 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'earth' 'human' 'all' '1'
+
+getoriginfromsuite() { echo -n 'Earth'; }
+getlabelfromsuite() { echo -n 'Blue Planet'; }
+getcodenamefromsuite() { echo -n 'home'; }
+getreleaseversionfromsuite() { echo -n '1.0'; }
+getnotautomaticfromsuite() { echo -n 'yes'; }
+getbutautomaticupgradesfromsuite() { echo -n 'yes'; }
+setupaptarchive --no-update
+testsuccess aptget update
+
+cp -a aptarchive/dists aptarchive/dists.bak
+cp -a rootdir/var/lib/apt/lists rootdir/var/lib/apt/lists.bak
+APTARCHIVE="$(readlink -f './aptarchive')"
+
+sed -i -e 's#^Origin: Earth#Origin: Mars#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Origin' value from 'Earth' to 'Mars'
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update
+testfailure apt update --allow-releaseinfo-change-label
+testsuccesswithnotice apt update --allow-releaseinfo-change
+testequal "All packages are up to date.
+N: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Origin' value from 'Earth' to 'Mars'" tail -n 2 rootdir/tmp/testsuccesswithnotice.output
+
+rm -rf rootdir/var/lib/apt/lists
+cp -a rootdir/var/lib/apt/lists.bak rootdir/var/lib/apt/lists
+sed -i -e 's#^Label: Blue#Label: Red#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Origin' value from 'Earth' to 'Mars'
+E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Label' value from 'Blue Planet' to 'Red Planet'
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update
+testfailure apt update --allow-releaseinfo-change-label
+testfailuremsg "N: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Origin' value from 'Earth' to 'Mars'
+E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Label' value from 'Blue Planet' to 'Red Planet'
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update --allow-releaseinfo-change-origin
+testsuccess apt update --allow-releaseinfo-change-origin --allow-releaseinfo-change-label -o quiet::ReleaseInfoChange=true
+
+# version changes are allowed by default
+sed -i -e 's#^Version: 1#Version: 2#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Version' value from '1.0' to '2.0'
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update --no-allow-releaseinfo-change-version
+testsuccesswithnotice apt update
+testequal "All packages are up to date.
+N: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Version' value from '1.0' to '2.0'" tail -n 2 rootdir/tmp/testsuccesswithnotice.output
+
+sed -i -e 's#^Codename: home#Codename: colony#' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Codename' value from 'home' to 'colony'
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update --no-allow-releaseinfo-change-codename
+testsuccesswithnotice apt update --allow-releaseinfo-change-codename
+testequal "All packages are up to date.
+N: Repository 'file:$APTARCHIVE earth InRelease' changed its 'Codename' value from 'home' to 'colony'" tail -n 2 rootdir/tmp/testsuccesswithnotice.output
+
+sed -i -e '/^ButAutomaticUpgrades: / d' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 100 to 1.
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update
+testsuccesswithnotice apt update --allow-releaseinfo-change
+testequal "All packages are up to date.
+N: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 100 to 1." tail -n 2 rootdir/tmp/testsuccesswithnotice.output
+
+sed -i -e '/^NotAutomatic: / d' -e '/^Codename: / a\
+Release-Notes: https://example.org/mars/release-notes' $(find ./aptarchive -name 'Release')
+signreleasefiles
+testfailuremsg "E: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 1 to 500.
+N: More information about this can be found online in the Release notes at: https://example.org/mars/release-notes
+N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details." apt update
+testsuccesswithnotice apt update --allow-releaseinfo-change-defaultpin
+testequal "All packages are up to date.
+N: Repository 'file:$APTARCHIVE earth InRelease' changed its default priority for apt_preferences(5) from 1 to 500.
+N: More information about this can be found online in the Release notes at: https://example.org/mars/release-notes" tail -n 3 rootdir/tmp/testsuccesswithnotice.output
diff --git a/test/integration/test-bug-602412-dequote-redirect b/test/integration/test-bug-602412-dequote-redirect
index 9c6aa3945..3db7b5ea0 100755
--- a/test/integration/test-bug-602412-dequote-redirect
+++ b/test/integration/test-bug-602412-dequote-redirect
@@ -30,7 +30,7 @@ Reading package lists..." aptget update
testsuccess --nomsg aptget install unrelated --download-only -y
}
-for CODE in 301 302 307; do
+for CODE in 301 302 307 308; do
webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
rm -f aptarchive/webserver.log.client*.log
testrun "$CODE" "http://localhost:${APTHTTPPORT}"
@@ -40,7 +40,7 @@ done
changetohttpswebserver
-for CODE in 301 302 307; do
+for CODE in 301 302 307 308; do
webserverconfig 'aptwebserver::redirect::httpcode' "$CODE"
rm -f aptarchive/webserver.log.client*.log
testrun "$CODE" "https://localhost:${APTHTTPSPORT}"
diff --git a/test/integration/test-bug-717891-abolute-uris-for-proxies b/test/integration/test-bug-717891-abolute-uris-for-proxies
index ed9b9a555..5f1b7546c 100755
--- a/test/integration/test-bug-717891-abolute-uris-for-proxies
+++ b/test/integration/test-bug-717891-abolute-uris-for-proxies
@@ -16,7 +16,7 @@ testfailure --nomsg aptget update --allow-insecure-repositories
echo "Acquire::http::Proxy \"http://localhost:${APTHTTPPORT}\";" > rootdir/etc/apt/apt.conf.d/99proxy
-msgtest 'Check that requests to proxies are' 'absolute uris'
+msgtest 'Check that requests to proxies are' 'absolute uris via config'
testsuccess --nomsg aptget update
testsuccessequal 'Reading package lists...
@@ -26,3 +26,28 @@ The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst unrelated (0.5~squeeze1 unstable [all])
Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s
+
+rm -f rootdir/etc/apt/apt.conf.d/99proxy
+echo "Acquire::http::Proxy-Auto-Detect \"${TMPWORKINGDIRECTORY}/apt-proxy-detect\";" > rootdir/etc/apt/apt.conf.d/02proxy-detect
+cat > "${TMPWORKINGDIRECTORY}/apt-proxy-detect" <<EOF
+#!/bin/sh
+set -e
+echo "http://localhost:${APTHTTPPORT}"
+EOF
+chmod 755 "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
+
+msgtest 'Check that requests to proxies are' 'absolute uris via auto-detect'
+testsuccess aptget update -o Debug::Acquire::http=1
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+The following NEW packages will be installed:
+ unrelated
+0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
+Inst unrelated (0.5~squeeze1 unstable [all])
+Conf unrelated (0.5~squeeze1 unstable [all])' aptget install unrelated -s
+
+chmod 444 "${TMPWORKINGDIRECTORY}/apt-proxy-detect"
+msgtest 'Check that non-executable proxy commands result in' 'permission error'
+testfailure --nomsg aptget update
+testsuccess grep 'can not be executed' rootdir/tmp/testfailure.output
diff --git a/test/integration/test-bug-738785-switch-protocol b/test/integration/test-bug-738785-switch-protocol
index 690e8727e..471d12e53 100755
--- a/test/integration/test-bug-738785-switch-protocol
+++ b/test/integration/test-bug-738785-switch-protocol
@@ -47,4 +47,4 @@ cd - >/dev/null
# check that downgrades from https to http are not allowed
webserverconfig 'aptwebserver::support::http' 'true'
sed -i -e "s#:${APTHTTPPORT}/redirectme#:${APTHTTPSPORT}/downgrademe#" -e 's# http:# https:#' rootdir/etc/apt/sources.list.d/*
-testfailure aptget update --allow-insecure-repositories -o Acquire::https::Timeout=1
+testfailure aptget update --allow-insecure-repositories -o Acquire::https::Timeout=1 -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::https=1
diff --git a/test/integration/test-bug-838779-untrusted-to-trusted-Release-hit b/test/integration/test-bug-838779-untrusted-to-trusted-Release-hit
index 6fcc2b8e1..50234753b 100755
--- a/test/integration/test-bug-838779-untrusted-to-trusted-Release-hit
+++ b/test/integration/test-bug-838779-untrusted-to-trusted-Release-hit
@@ -23,7 +23,8 @@ testdpkgnotinstalled 'foo'
msgmsg 'Untrusted to trusted hit' 'InRelease'
rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
mv rootdir/etc/apt/trusted.gpg.d rootdir/etc/apt/trusted.gpg.d-bak
-testwarning aptget update
+testfailure aptget update
+testwarning aptget update --allow-insecure-repositories
testfailure apt install foo -y
testdpkgnotinstalled 'foo'
mv rootdir/etc/apt/trusted.gpg.d-bak rootdir/etc/apt/trusted.gpg.d
@@ -37,7 +38,8 @@ msgmsg 'Untrusted to trusted hit' 'Release.gpg'
find aptarchive -name 'InRelease' -delete
rm -rf rootdir/var/lib/apt/lists rootdir/var/cache/apt/archives
mv rootdir/etc/apt/trusted.gpg.d rootdir/etc/apt/trusted.gpg.d-bak
-testwarning aptget update
+testfailure aptget update
+testwarning aptget update --allow-insecure-repositories
testfailure apt install foo -y
testdpkgnotinstalled 'foo'
mv rootdir/etc/apt/trusted.gpg.d-bak rootdir/etc/apt/trusted.gpg.d
diff --git a/test/integration/test-bug-841874-warning-for-mismatching-distribution b/test/integration/test-bug-841874-warning-for-mismatching-distribution
index 6cc8e3173..7502eefc3 100755
--- a/test/integration/test-bug-841874-warning-for-mismatching-distribution
+++ b/test/integration/test-bug-841874-warning-for-mismatching-distribution
@@ -47,15 +47,3 @@ testfailure apt show foo
ln -s "${APTARCHIVE}/dists/testing" "${APTARCHIVE}/dists/buster"
testsuccess apt update
testsuccess apt show foo
-
-# changing codenames gets a warning, too
-rm -rf rootdir/var/lib/apt/lists
-sed -i -e 's#buster#testing#g' rootdir/etc/apt/sources.list.d/*
-testsuccess apt update
-testsuccess apt show foo
-sed -i -e 's#^Codename: buster#Codename: zurg#g' $(find ./aptarchive -name 'Release')
-signreleasefiles
-testwarningmsg "W: Conflicting distribution: file:$APTARCHIVE testing/updates InRelease (expected buster/updates but got zurg/updates)" apt update
-testsuccess apt show foo
-testsuccess apt update
-testsuccess apt show foo
diff --git a/test/integration/test-dpkg-normalization b/test/integration/test-dpkg-normalization
new file mode 100755
index 000000000..cfcb90d67
--- /dev/null
+++ b/test/integration/test-dpkg-normalization
@@ -0,0 +1,44 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture "i386"
+
+insertpackage 'unstable' 'spaces' 'i386' '1.0' 'Depends: spaces (= 1.0)'
+insertpackage 'unstable' 'spaces' 'i386' '1.0' 'Depends: spaces (= 1.0)'
+insertpackage 'unstable' 'lessequal' 'i386' '1.0' 'Depends: spaces (>= 1.0)'
+insertpackage 'unstable' 'lessequal' 'i386' '1.0' 'Depends: spaces (> 1.0)'
+insertpackage 'unstable' 'zero-epoch' 'i386' '1.0' 'Depends: spaces (< 0:1.0.0)'
+insertpackage 'unstable' 'zero-epoch' 'i386' '1.0' 'Depends: spaces (< 1.0.0)'
+insertpackage 'unstable' 'zero-epoch' 'i386' '0:1.0' 'Depends: spaces (< 0:1.0.0)'
+
+setupaptarchive
+
+testsuccessequal "spaces:
+ Installed: (none)
+ Candidate: 1.0
+ Version table:
+ 1.0 500
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages" aptcache policy spaces
+
+testsuccessequal "lessequal:
+ Installed: (none)
+ Candidate: 1.0
+ Version table:
+ 1.0 500
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages" aptcache policy lessequal
+
+
+
+testsuccessequal "zero-epoch:
+ Installed: (none)
+ Candidate: 1.0
+ Version table:
+ 1.0 500
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages
+ 500 file:$TMPWORKINGDIRECTORY/aptarchive unstable/main i386 Packages" aptcache policy zero-epoch
diff --git a/test/integration/test-handle-redirect-as-used-mirror-change b/test/integration/test-handle-redirect-as-used-mirror-change
index 254bdd54a..a6f8b788f 100755
--- a/test/integration/test-handle-redirect-as-used-mirror-change
+++ b/test/integration/test-handle-redirect-as-used-mirror-change
@@ -89,5 +89,6 @@ Reading package lists..." aptget update
rm -rf rootdir/var/lib/apt/lists
find aptarchive -name 'Release.gpg' -delete
find aptarchive -name 'Release' -delete
-testwarning aptget update
+testfailure aptget update
+testwarning aptget update --allow-insecure-repositories
testsuccess grep 'does not have a Release file' rootdir/tmp/testwarning.output
diff --git a/test/integration/test-pdiff-usage b/test/integration/test-pdiff-usage
index 430551fa4..e7b052d49 100755
--- a/test/integration/test-pdiff-usage
+++ b/test/integration/test-pdiff-usage
@@ -50,7 +50,7 @@ wasmergeused() {
if echo "$*" | grep -q -- '-o test::cannot-use-pdiff=1'; then
msgtest 'Check if pdiff was' 'not used'
cp -a rootdir/tmp/testsuccess.output rootdir/tmp/aptupdate.output
- testsuccess --nomsg grep "diff/Index with Message: Couldn't parse pdiff index" rootdir/tmp/aptupdate.output
+ testsuccess --nomsg grep "^Ign:.* Packages\.diff/Index" rootdir/tmp/aptupdate.output
return;
fi
@@ -336,7 +336,7 @@ SHA256-Download:
generatereleasefiles '+1hour'
signreleasefiles
wasmergeused "$@" -o test::cannot-use-pdiff=1
- testsuccess grep 'bytes (Limit is' rootdir/tmp/aptupdate.output
+ testsuccess grep 'bytes, but limit is' rootdir/tmp/aptupdate.output
testnopackage oldstuff
testsuccessequal "$(cat "${PKGFILE}-new")
" aptcache show apt newstuff
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index 30238bd87..5676d1457 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -238,7 +238,7 @@ testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 990 "" -o Test=ButAutomat
rm incoming/backports.main.pkglist incoming/backports.main.srclist
buildsimplenativepackage "coolstuff" "all" "2.0~bpo2" "backports"
-setupaptarchive
+setupaptarchive --no-update
sed -i aptarchive/dists/backports/Release -e 1i"NotAutomatic: yes"
signreleasefiles
diff --git a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
index a756b5df2..46c7c5672 100755
--- a/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
+++ b/test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
@@ -70,3 +70,12 @@ partial' ls "$LISTS"
runtests '^E:.*Clearsigned file .*NOSPLIT.*'
webserverconfig 'aptwebserver::overwrite::.*InRelease::filename' '/404'
runtests '^E:.*Signed file .*NODATA.*'
+
+webserverconfig 'aptwebserver::overwrite::.*::filename' '/404'
+webserverconfig 'aptwebserver::httpcode::404' '511 Network Authentication Required'
+rm -rf rootdir/var/lib/apt/lists
+testfailureequal "Err:1 http://localhost:${APTHTTPPORT} unstable InRelease
+ 511 Network Authentication Required
+Reading package lists...
+E: Failed to fetch http://localhost:${APTHTTPPORT}/dists/unstable/InRelease 511 Network Authentication Required
+E: Some index files failed to download. They have been ignored, or old ones used instead." apt update
diff --git a/test/interactive-helper/aptwebserver.cc b/test/interactive-helper/aptwebserver.cc
index 4b98cbd7c..b4b3ef870 100644
--- a/test/interactive-helper/aptwebserver.cc
+++ b/test/interactive-helper/aptwebserver.cc
@@ -23,10 +23,10 @@
#include <unistd.h>
#include <algorithm>
-#include <iostream>
#include <fstream>
-#include <sstream>
+#include <iostream>
#include <list>
+#include <sstream>
#include <string>
#include <thread>
#include <vector>
@@ -54,6 +54,7 @@ static std::string httpcodeToStr(int const httpcode) /*{{{*/
case 304: return _config->Find("aptwebserver::httpcode::304", "304 Not Modified");
case 305: return _config->Find("aptwebserver::httpcode::305", "305 Use Proxy");
case 307: return _config->Find("aptwebserver::httpcode::307", "307 Temporary Redirect");
+ case 308: return _config->Find("aptwebserver::httpcode::308", "308 Permanent Redirect");
// Client errors 4xx
case 400: return _config->Find("aptwebserver::httpcode::400", "400 Bad Request");
case 401: return _config->Find("aptwebserver::httpcode::401", "401 Unauthorized");
@@ -127,7 +128,7 @@ static bool sendHead(std::ostream &log, int const client, int const httpcode, st
std::stringstream buffer;
auto const empties = _config->FindVector("aptwebserver::empty-response-header");
- for (auto && e: empties)
+ for (auto const &e: empties)
buffer << e << ":" << std::endl;
_config->Dump(buffer, "aptwebserver::response-header", "%t: %v%n", false);
std::vector<std::string> addheaders = VectorizeString(buffer.str(), '\n');
diff --git a/test/interactive-helper/extract-control.cc b/test/interactive-helper/extract-control.cc
index 852ec4ee9..a19e0380c 100644
--- a/test/interactive-helper/extract-control.cc
+++ b/test/interactive-helper/extract-control.cc
@@ -4,8 +4,8 @@
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
-#include <string>
#include <iostream>
+#include <string>
#include <unistd.h>
using namespace std;
diff --git a/test/interactive-helper/rpmver.cc b/test/interactive-helper/rpmver.cc
index 017c92fba..b23ba2876 100644
--- a/test/interactive-helper/rpmver.cc
+++ b/test/interactive-helper/rpmver.cc
@@ -1,11 +1,11 @@
#include <config.h>
#include <apt-pkg/debversion.h>
-#include <rpm/rpmio.h>
+#include <ctype.h>
#include <rpm/misc.h>
-#include <stdlib.h>
+#include <rpm/rpmio.h>
#include <stdio.h>
-#include <ctype.h>
+#include <stdlib.h>
#define xisdigit(x) isdigit(x)
#define xisalpha(x) isalpha(x)
diff --git a/test/interactive-helper/teestream.h b/test/interactive-helper/teestream.h
index 728a1bae2..058717ac3 100644
--- a/test/interactive-helper/teestream.h
+++ b/test/interactive-helper/teestream.h
@@ -8,8 +8,8 @@
a logfile easily, so don't expect that to be a bulletproof
implementation. */
-#include <iostream>
#include <apt-pkg/macros.h>
+#include <iostream>
template <typename CharT, typename Traits = std::char_traits<CharT>
> class basic_teebuf: public std::basic_streambuf<CharT, Traits>
diff --git a/test/interactive-helper/test_fileutl.cc b/test/interactive-helper/test_fileutl.cc
index 7c4b95759..6c29b748f 100644
--- a/test/interactive-helper/test_fileutl.cc
+++ b/test/interactive-helper/test_fileutl.cc
@@ -1,13 +1,13 @@
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/error.h>
-#include <sys/types.h>
+#include <fcntl.h>
+#include <stdlib.h>
#include <sys/stat.h>
+#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
-#include <stdlib.h>
-#include <fcntl.h>
#include <iostream>
#include <string>
diff --git a/test/interactive-helper/test_udevcdrom.cc b/test/interactive-helper/test_udevcdrom.cc
index b87dcd935..2355186d6 100644
--- a/test/interactive-helper/test_udevcdrom.cc
+++ b/test/interactive-helper/test_udevcdrom.cc
@@ -2,11 +2,11 @@
#include <apt-pkg/cdrom.h>
-#include <stddef.h>
+#include <iostream>
#include <string>
-#include <assert.h>
#include <vector>
-#include <iostream>
+#include <assert.h>
+#include <stddef.h>
int main()
{
diff --git a/test/interactive-helper/testdeb.cc b/test/interactive-helper/testdeb.cc
index 69e1ffe0b..0bb24a52a 100644
--- a/test/interactive-helper/testdeb.cc
+++ b/test/interactive-helper/testdeb.cc
@@ -1,10 +1,10 @@
#include <config.h>
-#include <apt-pkg/dirstream.h>
+#include <apt-pkg/arfile.h>
#include <apt-pkg/debfile.h>
+#include <apt-pkg/dirstream.h>
#include <apt-pkg/error.h>
#include <apt-pkg/extracttar.h>
-#include <apt-pkg/arfile.h>
#include <apt-pkg/fileutl.h>
#include <iostream>
diff --git a/test/libapt/acqprogress_test.cc b/test/libapt/acqprogress_test.cc
index 0e82a285d..d4596c85d 100644
--- a/test/libapt/acqprogress_test.cc
+++ b/test/libapt/acqprogress_test.cc
@@ -1,12 +1,12 @@
#include <config.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/acquire.h>
#include <apt-pkg/acquire-item.h>
+#include <apt-pkg/acquire.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/hashes.h>
#include <apt-private/acqprogress.h>
-#include <string>
-#include <sstream>
#include <gtest/gtest.h>
+#include <sstream>
+#include <string>
class TestItem: public pkgAcquire::Item
{
diff --git a/test/libapt/cdrom_test.cc b/test/libapt/cdrom_test.cc
index b4c51cdb0..c9021e64e 100644
--- a/test/libapt/cdrom_test.cc
+++ b/test/libapt/cdrom_test.cc
@@ -1,13 +1,13 @@
#include <config.h>
-#include <apt-pkg/configuration.h>
#include <apt-pkg/cdrom.h>
#include <apt-pkg/cdromutl.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/fileutl.h>
#include <string>
-#include <string.h>
#include <vector>
+#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc
index 0d8eb1f90..f6acf18fd 100644
--- a/test/libapt/cdromfindpackages_test.cc
+++ b/test/libapt/cdromfindpackages_test.cc
@@ -5,10 +5,10 @@
#include <apt-pkg/fileutl.h>
#include <algorithm>
+#include <iostream>
#include <string>
#include <vector>
#include <stddef.h>
-#include <iostream>
#include <gtest/gtest.h>
diff --git a/test/libapt/compareversion_test.cc b/test/libapt/compareversion_test.cc
index 3b2c0c209..1782c61cc 100644
--- a/test/libapt/compareversion_test.cc
+++ b/test/libapt/compareversion_test.cc
@@ -18,15 +18,15 @@
/*}}}*/
#include <config.h>
-#include <apt-pkg/error.h>
#include <apt-pkg/debversion.h>
+#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <fstream>
#include <string>
#include <stdlib.h>
-#include <unistd.h>
#include <sys/wait.h>
+#include <unistd.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/extracttar_test.cc b/test/libapt/extracttar_test.cc
index 0255bd767..30934144a 100644
--- a/test/libapt/extracttar_test.cc
+++ b/test/libapt/extracttar_test.cc
@@ -3,8 +3,8 @@
#include <iostream>
#include <stdlib.h>
-#include <gtest/gtest.h>
#include "assert.h"
+#include <gtest/gtest.h>
class Stream : public pkgDirStream
{
diff --git a/test/libapt/file-helpers.cc b/test/libapt/file-helpers.cc
index 48d8a9fbb..aa16a2e30 100644
--- a/test/libapt/file-helpers.cc
+++ b/test/libapt/file-helpers.cc
@@ -2,10 +2,10 @@
#include <string>
-#include <unistd.h>
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <fcntl.h>
+#include <unistd.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
index 67bd850a1..6cc850033 100644
--- a/test/libapt/fileutl_test.cc
+++ b/test/libapt/fileutl_test.cc
@@ -1,10 +1,10 @@
#include <config.h>
+#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/aptconfiguration.h>
-#include <apt-pkg/configuration.h>
#include <algorithm>
#include <string>
@@ -25,7 +25,9 @@ static void TestFileFd(mode_t const a_umask, mode_t const ExpectedFilePermission
static const char* fname = "apt-filefd-test.txt";
if (FileExists(fname) == true)
+ {
EXPECT_EQ(0, unlink(fname));
+ }
FileFd f;
umask(a_umask);
@@ -290,7 +292,9 @@ TEST(FileUtlTest, Popen)
// ensure that after a close all is good again
if(FileExists("/proc/self/fd"))
+ {
EXPECT_EQ(Glob("/proc/self/fd/*").size(), OpenFds.size());
+ }
// ReadWrite is not supported
_error->PushToStack();
diff --git a/test/libapt/getlanguages_test.cc b/test/libapt/getlanguages_test.cc
index 29ff0c9ae..26ff66f72 100644
--- a/test/libapt/getlanguages_test.cc
+++ b/test/libapt/getlanguages_test.cc
@@ -10,9 +10,9 @@
#include <string>
#include <vector>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/getlistoffilesindir_test.cc b/test/libapt/getlistoffilesindir_test.cc
index 8c5e56b1d..606e2733e 100644
--- a/test/libapt/getlistoffilesindir_test.cc
+++ b/test/libapt/getlistoffilesindir_test.cc
@@ -1,11 +1,11 @@
#include <config.h>
-#include <apt-pkg/fileutl.h>
#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <iostream>
#include <string>
#include <vector>
-#include <iostream>
#include <gtest/gtest.h>
diff --git a/test/libapt/globalerror_test.cc b/test/libapt/globalerror_test.cc
index bb36905a4..67682c275 100644
--- a/test/libapt/globalerror_test.cc
+++ b/test/libapt/globalerror_test.cc
@@ -2,9 +2,9 @@
#include <apt-pkg/error.h>
-#include <stddef.h>
#include <string>
#include <errno.h>
+#include <stddef.h>
#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/gtest_runner.cc b/test/libapt/gtest_runner.cc
index 73854d976..5620aa0bd 100644
--- a/test/libapt/gtest_runner.cc
+++ b/test/libapt/gtest_runner.cc
@@ -1,9 +1,9 @@
#include <gtest/gtest.h>
#include <apt-pkg/configuration.h>
-#include <apt-pkg/pkgsystem.h>
#include <apt-pkg/error.h>
#include <apt-pkg/init.h>
+#include <apt-pkg/pkgsystem.h>
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
diff --git a/test/libapt/hashsums_test.cc b/test/libapt/hashsums_test.cc
index fb9a25643..8b4533265 100644
--- a/test/libapt/hashsums_test.cc
+++ b/test/libapt/hashsums_test.cc
@@ -1,16 +1,16 @@
#include <config.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/hashes.h>
#include <apt-pkg/md5.h>
#include <apt-pkg/sha1.h>
#include <apt-pkg/sha2.h>
#include <apt-pkg/strutl.h>
-#include <apt-pkg/hashes.h>
-#include <apt-pkg/fileutl.h>
#include <iostream>
-#include <stdlib.h>
#include <string>
+#include <stdlib.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/indexcopytosourcelist_test.cc b/test/libapt/indexcopytosourcelist_test.cc
index eb6d49edf..b0bfeb4b2 100644
--- a/test/libapt/indexcopytosourcelist_test.cc
+++ b/test/libapt/indexcopytosourcelist_test.cc
@@ -1,7 +1,7 @@
#include <config.h>
-#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/configuration.h>
#include <apt-pkg/indexcopy.h>
#include <string>
diff --git a/test/libapt/parsedepends_test.cc b/test/libapt/parsedepends_test.cc
index c2781b5d6..ed849f768 100644
--- a/test/libapt/parsedepends_test.cc
+++ b/test/libapt/parsedepends_test.cc
@@ -1,11 +1,11 @@
#include <config.h>
-#include <apt-pkg/deblistparser.h>
#include <apt-pkg/configuration.h>
+#include <apt-pkg/deblistparser.h>
#include <apt-pkg/pkgcache.h>
-#include <string.h>
#include <string>
+#include <string.h>
#include <gtest/gtest.h>
diff --git a/test/libapt/priority_test.cc b/test/libapt/priority_test.cc
index ef1941ce5..af7932ae8 100644
--- a/test/libapt/priority_test.cc
+++ b/test/libapt/priority_test.cc
@@ -1,7 +1,7 @@
#include <config.h>
#include <apt-pkg/pkgcache.h>
-#include <string>
#include <gtest/gtest.h>
+#include <string>
using std::string;
diff --git a/test/libapt/sourcelist_test.cc b/test/libapt/sourcelist_test.cc
index 83c441092..6182639a4 100644
--- a/test/libapt/sourcelist_test.cc
+++ b/test/libapt/sourcelist_test.cc
@@ -1,7 +1,7 @@
#include <config.h>
-#include <apt-pkg/sourcelist.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/sourcelist.h>
#include <string>
#include <stdlib.h>
diff --git a/test/libapt/srvrecs_test.cc b/test/libapt/srvrecs_test.cc
index 5253b1c34..4fcc96dae 100644
--- a/test/libapt/srvrecs_test.cc
+++ b/test/libapt/srvrecs_test.cc
@@ -77,7 +77,9 @@ TEST(SrvRecTest,Randomness)
EXPECT_TRUE(std::all_of(first_pull.begin(), first_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
EXPECT_TRUE(std::all_of(second_pull.begin(), second_pull.end(), [](SrvRec const &R) { return R.priority == 20; }));
if (startingClock != -1 && startingClock != clock())
+ {
EXPECT_FALSE(std::equal(first_pull.begin(), first_pull.end(), second_pull.begin()));
+ }
EXPECT_TRUE(std::all_of(base2.begin(), base2.end(), [](SrvRec const &R) { return R.priority == 30; }));
}
diff --git a/test/libapt/strutil_test.cc b/test/libapt/strutil_test.cc
index d7700bd54..9c192a58b 100644
--- a/test/libapt/strutil_test.cc
+++ b/test/libapt/strutil_test.cc
@@ -1,6 +1,6 @@
#include <config.h>
-#include <apt-pkg/strutl.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/strutl.h>
#include <string>
#include <vector>
diff --git a/test/libapt/tagfile_test.cc b/test/libapt/tagfile_test.cc
index 24fbd389e..fb85ebcad 100644
--- a/test/libapt/tagfile_test.cc
+++ b/test/libapt/tagfile_test.cc
@@ -3,11 +3,11 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/tagfile.h>
+#include <sstream>
#include <string>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-#include <sstream>
#include <gtest/gtest.h>
diff --git a/test/libapt/tagsection_test.cc b/test/libapt/tagsection_test.cc
index 779932595..d79b1b63d 100644
--- a/test/libapt/tagsection_test.cc
+++ b/test/libapt/tagsection_test.cc
@@ -3,8 +3,8 @@
#include <apt-pkg/fileutl.h>
#include <apt-pkg/tagfile.h>
-#include <string>
#include <sstream>
+#include <string>
#include <gtest/gtest.h>
diff --git a/test/libapt/teestream_test.cc b/test/libapt/teestream_test.cc
index 18610b24d..a897e08ec 100644
--- a/test/libapt/teestream_test.cc
+++ b/test/libapt/teestream_test.cc
@@ -1,9 +1,9 @@
#include <config.h>
-#include <string>
-#include <sstream>
-#include <fstream>
#include "../interactive-helper/teestream.h"
+#include <fstream>
+#include <sstream>
+#include <string>
#include <gtest/gtest.h>
diff --git a/test/libapt/uri_test.cc b/test/libapt/uri_test.cc
index 09d018049..54f4f84f8 100644
--- a/test/libapt/uri_test.cc
+++ b/test/libapt/uri_test.cc
@@ -2,8 +2,8 @@
#include <apt-pkg/configuration.h>
#include <apt-pkg/proxy.h>
#include <apt-pkg/strutl.h>
-#include <string>
#include <gtest/gtest.h>
+#include <string>
TEST(URITest, BasicHTTP)
{