diff options
Diffstat (limited to 'test/integration')
21 files changed, 304 insertions, 79 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 |