From afc7b0dbf1114f3d723ff0e1ab9d0796cd799970 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 28 Apr 2022 16:44:13 +0200 Subject: Do not assume mirror-URIs end in a filename causing a hang In practice most of them will, but making the acquire process hang in response if they don't seems like an overly excessive response if we can just support it gracefully to reply with an error (or actually succeed in the unlikely event this URI is actually correct). --- test/integration/test-method-mirror | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror index ce44b86e3..1784e1ecb 100755 --- a/test/integration/test-method-mirror +++ b/test/integration/test-method-mirror @@ -124,9 +124,22 @@ msgmsg 'all mirrored via file' APTARCHIVE="$(readlink -f ./aptarchive)" sed -i -e "s#mirror+http://localhost:${APTHTTPPORT}#mirror+file:${APTARCHIVE}#" rootdir/etc/apt/sources.list.d/* testrun '*_localhost_*' '*_aptarchive_mirror.txt.gz_*' +sed -i -e 's#/mirror\.txt\.gz stable#/mirror.txt stable#' rootdir/etc/apt/sources.list.d/* + +mv rootdir/etc/apt/sources.list.d rootdir/etc/apt/sources.list.d.bak +mkdir rootdir/etc/apt/sources.list.d +msgmsg 'fail gracefully if mirror uri has no filename' +echo "deb mirror://localhost:${APTHTTPPORT}/ stable main" > rootdir/etc/apt/sources.list.d/mirrordir.list +testfailure apt update + +msgmsg 'but succeed if it is indeed a mirror list' +ln -s mirror.txt aptarchive/index.html +testsuccess apt update +rm aptarchive/index.html rootdir/etc/apt/sources.list.d/mirrordir.list +rmdir rootdir/etc/apt/sources.list.d +mv rootdir/etc/apt/sources.list.d.bak rootdir/etc/apt/sources.list.d msgmsg 'fallback mirrors are used if needed' 'as usual' -sed -i -e 's#/mirror\.txt\.gz stable#/mirror.txt stable#' rootdir/etc/apt/sources.list.d/* echo "http://localhost:${APTHTTPPORT}/failure2 priority:3 http://localhost:${APTHTTPPORT}/redirectme priority:2 http://localhost:${APTHTTPPORT}/failure priority:1" > aptarchive/mirror.txt -- cgit v1.2.3-70-g09d2