uri.User.clear();
uri.Password.clear();
string descUri = string(uri);
- _error->Warning(_("Failed to fetch %s %s"), descUri.c_str(),
- (*I)->ErrorText.c_str());
-
+ // Show an error for non-transient failures, otherwise only warn
+ if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError)
+ _error->Warning(_("Failed to fetch %s %s"), descUri.c_str(),
+ (*I)->ErrorText.c_str());
+ else
+ _error->Error(_("Failed to fetch %s %s"), descUri.c_str(),
+ (*I)->ErrorText.c_str());
if ((*I)->Status == pkgAcquire::Item::StatTransientNetworkError)
{
TransientNetworkFailure = true;
touch -d '+1hour' "$pkg"
done
NEW_SIZE="$(stat --printf=%s aptarchive/dists/unstable/main/binary-i386/Packages)"
- testfailuremsg "W: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
+ testfailuremsg "E: Failed to fetch ${1}/dists/unstable/main/binary-i386/Packages Writing more data than expected ($NEW_SIZE > $SIZE)
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::Transaction=0
}
rm "${NEWMETHODS}/https"
testfailuremsg "E: The method driver ${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?
-W: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
+E: Failed to fetch https://localhost:${APTHTTPSPORT}/dists/stable/InRelease
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
posttest
# replace InRelease with something else
mv "$APTARCHIVE/dists/unstable/Release" "$APTARCHIVE/dists/unstable/InRelease"
- testfailuremsg "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
+ testfailuremsg "E: Failed to fetch file:${APTARCHIVE}/dists/unstable/InRelease Clearsigned file isn't valid, got 'NOSPLIT' (does the network require authentication?)
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
# ensure we keep the repo
Err:2 $1 unstable/main amd64 Packages
Hash Sum mismatch
Reading package lists...
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
rm -rf aptarchive/dists
Err:4 $1 unstable/main amd64 Packages
Hash Sum mismatch
Reading package lists...
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
rm -rf aptarchive/dists
break_repository_sources_index '+1hour'
# test the error condition
- testfailureequal "W: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources.gz Hash Sum mismatch
+ testfailureequal "E: Failed to fetch file:${APTARCHIVE}/dists/unstable/main/source/Sources.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
# ensure that the Packages file is also rolled back
testfileequal lists.before "$(listcurrentlistsdirectory)"
add_new_package '+1hour'
break_repository_sources_index '+1hour'
- testfailureequal "W: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources.gz Hash Sum mismatch
+ testfailureequal "E: Failed to fetch file:$APTARCHIVE/dists/unstable/main/source/Sources.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -qq
testfileequal lists.before "$(listcurrentlistsdirectory)"
aptarchive/dists/unstable/main/binary-i386/
# ensure this raises an error
-testfailuremsg "W: Failed to fetch http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-i386/Packages.gz Hash Sum mismatch
+testfailuremsg "E: Failed to fetch http://localhost:${APTHTTPPORT}/dists/unstable/main/binary-i386/Packages.gz Hash Sum mismatch
E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update -o Debug::pkgAcquire::Worker=1 -o Debug::Acquire::http=1
testfileequal lists.before "$(listcurrentlistsdirectory)"
msgmsg 'Release contains only weak hashes'
FILENAME="${APTARCHIVE}/dists/unstable/InRelease"
MANGLED="$(readlink -f ./rootdir)/var/lib/apt/lists/partial/$(echo "$FILENAME" | sed 's#/#_#g')"
-testfailuremsg "W: Failed to fetch file:${FILENAME} No Hash entry in Release file ${MANGLED}, which is considered strong enough for security purposes
+testfailuremsg "E: Failed to fetch file:${FILENAME} No Hash entry in Release file ${MANGLED}, which is considered strong enough for security purposes
E: Some index files failed to download. They have been ignored, or old ones used instead." apt update
testnopackage foo
testnosrcpackage foo
msgmsg 'Release contains no hashes'
sed -i -e '/^ / d' -e '/^MD5Sum:/ d' "$APTARCHIVE/dists/unstable/Release"
signreleasefiles
-testfailuremsg "W: Failed to fetch file:${FILENAME} No Hash entry in Release file ${MANGLED}
+testfailuremsg "E: Failed to fetch file:${FILENAME} No Hash entry in Release file ${MANGLED}
E: Some index files failed to download. They have been ignored, or old ones used instead." apt update
testnopackage foo
testnosrcpackage foo
Err:2 file:$APTARCHIVE Packages
Empty files can't be valid archives
Reading package lists...
-W: Failed to fetch store:$(readlink -f rootdir/var/lib/apt/lists/partial/$(echo "$APTARCHIVE" | sed -e 's#/#_#g')_Packages.${COMPRESS}) Empty files can't be valid archives
+E: Failed to fetch store:$(readlink -f rootdir/var/lib/apt/lists/partial/$(echo "$APTARCHIVE" | sed -e 's#/#_#g')_Packages.${COMPRESS}) Empty files can't be valid archives
E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file"
}
Err:2 http://localhost:${APTHTTPPORT} Packages
Empty files can't be valid archives
Reading package lists...
-W: Failed to fetch store:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS}) Empty files can't be valid archives
+E: Failed to fetch store:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS}) Empty files can't be valid archives
E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http"
}
LISTS='rootdir/var/lib/apt/lists'
rm -rf rootdir/var/lib/apt/lists
testfailure aptget update
-testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
+testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0
testequal 'lock
done
testfailure aptget update
-testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
+testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
ensure_n_canary_strings_in_dir "$LISTS" 'peng neee-wom' 4
ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0
rm -f "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release" "$LISTS/localhost:${APTHTTPPORT}_dists_stable_Release.gpg"
msgtest 'excpected failure of' 'apt-get update'
testfailure aptget update
-testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
+testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
ensure_n_canary_strings_in_dir "$LISTS" 'peng neee-wom' 3
ensure_n_canary_strings_in_dir "$LISTS" 'ni ni ni' 0
done
testfailure aptget update
-testsuccess grep '^W:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
+testsuccess grep '^E:.*Clearsigned file .*NOSPLIT.*' rootdir/tmp/testfailure.output
ROOTDIR="$(readlink -f .)"