]> git.saurik.com Git - apt.git/commitdiff
Report non-transient errors as errors, not as warnings
authorJulian Andres Klode <jak@debian.org>
Wed, 16 Mar 2016 15:46:39 +0000 (16:46 +0100)
committerJulian Andres Klode <jak@debian.org>
Wed, 16 Mar 2016 16:56:50 +0000 (17:56 +0100)
This makes it easier to understand what really is an error
and what not.

apt-pkg/update.cc
test/integration/test-apt-update-expected-size
test/integration/test-apt-update-failure-propagation
test/integration/test-apt-update-nofallback
test/integration/test-apt-update-not-modified
test/integration/test-apt-update-rollback
test/integration/test-apt-update-stale
test/integration/test-apt-update-weak-hashes
test/integration/test-bug-595691-empty-and-broken-archive-files
test/integration/test-ubuntu-bug-346386-apt-get-update-paywall
test/integration/test-ubuntu-bug-784473-InRelease-one-message-only

index 369e8512272647bd386a14d9672584df403c7de1..ca87c6976a0025868b7b96708481ac844a115932 100644 (file)
@@ -73,9 +73,13 @@ bool AcquireUpdate(pkgAcquire &Fetcher, int const PulseInterval,
       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;
index 079e94802a72e8dc3bb8718dc6d5d2fb1e32261a..4981e72c3510ff7464dbaa449b3816febbaf034a 100755 (executable)
@@ -36,7 +36,7 @@ test_packagestoobig() {
                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
 }
 
index 1514614eaa0f6438d3d3e063acac55ed5d9e22a4..18f5efa11f3cc942abe55e184e6ee76da1a1ac1c 100755 (executable)
@@ -80,7 +80,7 @@ pretest
 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
 
index 4804b0ae60146c56588d7cc5034e92e87b063647..d9166eefd10589177aec610a012687dd9c876fec 100755 (executable)
@@ -149,7 +149,7 @@ test_subvert_inrelease()
     # 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
index ce3bc0dd31698e49eced406d864f0d73afb56e88..b1f801bc519c5548d7a6d4674bb2268012dfa498 100755 (executable)
@@ -48,7 +48,7 @@ Get:2 $1 unstable/main amd64 Packages [$SIZE B]
 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
@@ -109,7 +109,7 @@ Get:4 $1 unstable/main amd64 Packages [$SIZE B]
 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
index 255d361e3311f4f64c025bd43c683bf97f3911e4..dc95627d7108298b4fbdbec8c167826ba888d547 100755 (executable)
@@ -60,7 +60,7 @@ test_inrelease_to_broken_hash_reverts_all() {
     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)"
@@ -126,7 +126,7 @@ E: There were unauthenticated packages and -y was used without --allow-unauthent
     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)"
index 4c3b1a79039901fec2cb08f723e1e90e14d465b9..72b05a96608156afcb42ef15625433d58b4c1876 100755 (executable)
@@ -39,6 +39,6 @@ cp -p aptarchive/dists/unstable/main/binary-i386/saved/Packages* \
      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)"
index 38c73909918578b741cd2c20048247a351d6ca9b..f6b68fff0ee28a527f624bb128c3623b163cf8c6 100755 (executable)
@@ -17,7 +17,7 @@ APTARCHIVE="$(readlink -f ./aptarchive)"
 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
@@ -25,7 +25,7 @@ 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
index c329b76d22271b6c9fece5cba378e57b6469d25f..8d06f09c01d86c7cd2eccd17c1108bebf2f5dfaa 100755 (executable)
@@ -55,7 +55,7 @@ Reading package lists..." "empty archive Packages.$COMPRESS over file"
 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"
 }
 
@@ -72,7 +72,7 @@ Reading package lists..." "empty archive Packages.$COMPRESS over http"
 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"
 }
 
index bb595f78501abcb5973d8aea6e2526059a5d78a3..07c13434c24313da06243d1115db2fd7893dd4e4 100755 (executable)
@@ -37,7 +37,7 @@ ensure_n_canary_strings_in_dir() {
 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
@@ -50,7 +50,7 @@ for f in Release Release.gpg main_binary-amd64_Packages main_source_Sources; do
 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
@@ -61,7 +61,7 @@ chmod 644 "$LISTS/localhost:${APTHTTPPORT}_dists_stable_InRelease"
 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
index 782798e1be1f9fb97afffa6eb9395afb2ce8df18..21d7129aeba5ef93c0f94f3e005c0b02618337d5 100755 (executable)
@@ -28,7 +28,7 @@ MD5Sum:
 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 .)"