summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2021-09-12 16:08:52 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2021-09-13 16:08:52 +0200
commit2b0369a5d1673d9e40f2af4db7677b040a26ee58 (patch)
treed1c588de1ad6534fc942dd117002e0dda1de15a1 /test/integration/framework
parent883a12310a4130370965eab0a710a2c8fae6cc09 (diff)
Read and work with canonical file-URIs from sources.lists
We allow file (and other file-based methods) URIs to either be given as file:///path or as file:/path, but in various places of the acquire system we perform string comparisons on URIs which do not handle this expecting the canonical representation produced by our URI code. That used to be hidden by us quoting and dequoting the URIs in the system, but as we don't do this anymore we have to be a bit more careful on input. Ideally we would do less of these comparisons, but for now lets be content with inserting a canonicalisation early on to prevent hangs in the acquire system.
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework31
1 files changed, 20 insertions, 11 deletions
diff --git a/test/integration/framework b/test/integration/framework
index 1f942d162..009eed9cd 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -1181,7 +1181,7 @@ setupdistsaptarchive() {
SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ')
msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… "
echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list"
- echo "deb-src file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list"
+ echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list"
msgdone "info"
done
}
@@ -1198,7 +1198,7 @@ setupflataptarchive() {
fi
if [ -f "${APTARCHIVE}/Sources" ]; then
msgninfo "\tadd deb-src sources.list line… "
- echo "deb-src file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list'
+ echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list'
msgdone 'info'
else
rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list'
@@ -1360,10 +1360,13 @@ webserverconfig() {
}
rewritesourceslist() {
- local APTARCHIVE="file://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')"
- local APTARCHIVE2="copy://$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')"
+ local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')"
for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do
- sed -i $LIST -e "s#$APTARCHIVE#${1}#" -e "s#$APTARCHIVE2#${1}#" \
+ sed -i $LIST \
+ -e "s#file://$APTARCHIVE#${1}#" \
+ -e "s#file:$APTARCHIVE#${1}#" \
+ -e "s#copy://$APTARCHIVE#${1}#" \
+ -e "s#copy:$APTARCHIVE#${1}#" \
-e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \
-e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#"
done
@@ -1384,10 +1387,9 @@ waitforpidfile() {
}
changetowebserver() {
- local REWRITE='no'
- if [ "$1" != '--no-rewrite' ]; then
- REWRITE='yes'
- else
+ local REWRITE='yes'
+ if [ "$1" = '--no-rewrite' ]; then
+ REWRITE='no'
shift
fi
if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then
@@ -1412,12 +1414,17 @@ changetowebserver() {
else
msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver'
fi
- if [ "$REWRTE" != 'yes' ]; then
+ if [ "$REWRITE" != 'no' ]; then
rewritesourceslist "http://localhost:${APTHTTPPORT}/"
fi
}
changetohttpswebserver() {
+ local REWRITE='yes'
+ if [ "$1" = '--no-rewrite' ]; then
+ REWRITE='no'
+ shift
+ fi
local stunnel4
if command -v stunnel4 >/dev/null 2>&1; then
stunnel4=stunnel4
@@ -1446,7 +1453,9 @@ connect = $APTHTTPPORT
addtrap 'prefix' "kill ${PID};"
APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)"
webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}"
- rewritesourceslist "https://localhost:${APTHTTPSPORT}/"
+ if [ "$REWRITE" != 'no' ]; then
+ rewritesourceslist "https://localhost:${APTHTTPSPORT}/"
+ fi
}
changetocdrom() {