You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

67 lines
3.0 KiB

  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'amd64'
  7. # build two uncompressed packages
  8. buildsimplenativepackage 'alpha' 'all' '1' 'unstable' '' '' 'section' 'optional' '' 'none'
  9. setupaptarchive --no-update
  10. ORIGINAL_SHA256=$(sha256sum aptarchive/pool/alpha_1_all.deb | awk '{print $1}')
  11. ORIGINAL_SIZE=$(wc -c aptarchive/pool/alpha_1_all.deb | awk '{print $1}')
  12. SHA256="DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF"
  13. changetowebserver
  14. webserverconfig aptwebserver::redirect::replace::alpha_1_all.deb "beeta_1_all.deb%250a%250a201%2520URI%2520Done%250aURI:%2520http://localhost:${APTHTTPPORT}/pool/beeta_1_all.deb%250aFilename:%2520${TMPWORKINGDIRECTORY}/rootdir/var/cache/apt/archives/partial/alpha_1_all.deb%250aSize:%252020672%250aLast-Modified:%2520Fri,%252018%2520Jan%25202019%252009:52:02%2520+0000%250aSHA256-Hash:%2520${SHA256}%250aChecksum-FileSize-Hash:%252012345%250a%250a%0a"
  15. testsuccess apt update -o debug::http=1 -o debug::pkgacquire::worker=1
  16. testfailureequal "Reading package lists...
  17. Building dependency tree...
  18. The following NEW packages will be installed:
  19. alpha
  20. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  21. Need to get 20.7 kB of archives.
  22. After this operation, 11.3 kB of additional disk space will be used.
  23. Err:1 http://localhost:${APTHTTPPORT} unstable/main all alpha all 1
  24. SECURITY: URL redirect target contains control characters, rejecting.
  25. E: Failed to fetch http://localhost:${APTHTTPPORT}/pool/alpha_1_all.deb SECURITY: URL redirect target contains control characters, rejecting.
  26. E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?" aptget install alpha
  27. # For reference, the following is the original reproducer/bug. It has
  28. # been disabled using exit 0, as it will fail in fixed versions.
  29. exit 0
  30. testfailureequal "Reading package lists...
  31. Building dependency tree...
  32. The following NEW packages will be installed:
  33. alpha
  34. 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
  35. Need to get 20.7 kB of archives.
  36. After this operation, 11.3 kB of additional disk space will be used.
  37. Err:1 http://localhost:${APTHTTPPORT} unstable/main all alpha all 1
  38. Hash Sum mismatch
  39. Hashes of expected file:
  40. - SHA256:$ORIGINAL_SHA256
  41. - Filesize:$ORIGINAL_SIZE [weak]
  42. Hashes of received file:
  43. - SHA256:DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF
  44. - Filesize:12345 [weak]
  45. Last modification reported: Fri, 18 Jan 2019 09:52:02 +0000
  46. E: Failed to fetch http://localhost:${APTHTTPPORT}/pool/beeta_1_all.deb Hash Sum mismatch
  47. Hashes of expected file:
  48. - SHA256:$ORIGINAL_SHA256
  49. - Filesize:$ORIGINAL_SIZE [weak]
  50. Hashes of received file:
  51. - SHA256:DEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEFDEADBEEF
  52. - Filesize:12345 [weak]
  53. Last modification reported: Fri, 18 Jan 2019 09:52:02 +0000
  54. E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?" aptget install alpha