From ebf7b6babd4f313f29751a314850a4264aeff0bb Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Wed, 31 May 2023 16:54:28 +0200 Subject: [PATCH 01/13] gha: install coreutils on macos test job --- .github/workflows/ci.ml | 1 + .github/workflows/main.yml | 2 ++ master_changes.md | 1 + 3 files changed, 4 insertions(+) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 907a8861f1f..4f3b4c82383 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -369,6 +369,7 @@ let main_test_job ~analyse_job ~build_linux_job ~build_windows_job:_ ~build_macO let host = host_of_platform platform in let ocamlv = "${{ matrix.ocamlv }}" in job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env:[("OPAM_TEST", "1")] ~matrix ~needs ("Test-" ^ name_of_platform platform) + ++ only_on MacOS (install_sys_packages ["coreutils"] ~descr:"Install gnu coreutils" [MacOS]) ++ checkout () ++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"]) ++ cache Archives diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a927500805..fbf157ad709 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -325,6 +325,8 @@ jobs: env: OPAM_TEST: 1 steps: + - name: Install gnu coreutils + run: brew install coreutils - name: Checkout tree uses: actions/checkout@v3 - name: src_ext/archives and opam-repository Cache diff --git a/master_changes.md b/master_changes.md index e413f208052..0e6ad843ef5 100644 --- a/master_changes.md +++ b/master_changes.md @@ -106,6 +106,7 @@ users) ### Engine ## Github Actions + * Add coreutils install for cheksum validation tests [#5560 @rjbou] ## Doc From 2412e335e0cef1df4d8254dbd4c6952d8b211d63 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Mon, 22 May 2023 19:25:59 +0200 Subject: [PATCH 02/13] reftests: add tests for the extra-files field and the extra-sources section --- master_changes.md | 1 + tests/reftests/dune.inc | 36 + tests/reftests/extrafile.test | 570 ++++++++++++++ tests/reftests/extrasource.test | 1283 +++++++++++++++++++++++++++++++ 4 files changed, 1890 insertions(+) create mode 100644 tests/reftests/extrafile.test create mode 100644 tests/reftests/extrasource.test diff --git a/master_changes.md b/master_changes.md index 0e6ad843ef5..c8284582474 100644 --- a/master_changes.md +++ b/master_changes.md @@ -102,6 +102,7 @@ users) ## Reftests ### Tests * Lint: add test for W53, to test extra file with good hash [#5639 @rjbou] + * Add several checksum & cache validation checks for extra-source section, and extra-file field [#5560 @rjbou] ### Engine diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index b6bc9bce24a..6a400de054e 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -488,6 +488,42 @@ %{targets} (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:env.win32.test} %{read-lines:testing-env})))) +(rule + (alias reftest-extrafile) + (action + (diff extrafile.test extrafile.out))) + +(alias + (name reftest) + (deps (alias reftest-extrafile))) + +(rule + (targets extrafile.out) + (deps root-N0REP0) + (package opam) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:extrafile.test} %{read-lines:testing-env})))) + +(rule + (alias reftest-extrasource) + (action + (diff extrasource.test extrasource.out))) + +(alias + (name reftest) + (deps (alias reftest-extrasource))) + +(rule + (targets extrasource.out) + (deps root-N0REP0) + (package opam) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:extrasource.test} %{read-lines:testing-env})))) + (rule (alias reftest-init) (action diff --git a/tests/reftests/extrafile.test b/tests/reftests/extrafile.test new file mode 100644 index 00000000000..bb30f20a6a4 --- /dev/null +++ b/tests/reftests/extrafile.test @@ -0,0 +1,570 @@ +N0REP0 +### ::: Setup ::: +### +Trust me, im' a patch! +### openssl md5 p.patch | '.*= ' -> '' >$ PATCH_MD5 +### openssl sha256 p.patch | '.*= ' -> '' >$ PATCH_SHA256 +### +set -ue +pkg=$1 +pkgpath="REPO/packages/${pkg%.*}/$pkg" +if [ ! -d $pkgpath/files ] ; then + mkdir $pkgpath/files + cp p.patch $pkgpath/files/ +fi +### ::: Setup: extra-file field ::: +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch" "md5=patch-md5"] +] +### sh add-files.sh good-md5.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch" "md5=patch-md5"] + ["p.patch" "sha256=patch-sha256"] +] +### sh add-files.sh good-md5-good-sha256.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch" "md5=00000000000000000000000000000000"] +] +### sh add-files.sh bad-md5.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch" "md5=patch-md5"] + ["p.patch" "sha256=0000000000000000000000000000000000000000000000000000000000000000"] +] +### sh add-files.sh good-md5-bad-sha256.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch"] +] +### sh add-files.sh no-checksum.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +### sh add-files.sh not-mentioned.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["p.patch" "md5=00000000000000000000000000000000"] +] +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +extra-files: [ + ["/etc/passwdd" "md5=c316eacc19a12732bb894667a08e9c14"] +] +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "p.patch" ] +extra-files: [ + ["../../../no-checksum/no-checksum.1/files/p.patch" "md5=patch-md5"] +] +### +set -ue + +for p in `ls REPO/packages/*/*/opam`; do + sed -i.bak "s/patch-md5/$PATCH_MD5/" $p + sed -i.bak "s/patch-sha256/$PATCH_SHA256/" $p +done +### sh update-hashes.sh +### opam update default + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[default] synchronised from file://${BASEDIR}/REPO +Now run 'opam upgrade' to apply any package updates. +### ::: End setup ::: +### opam switch create --empty robur +### OPAMSTRICT=no +### ::::::::::::::::: +### :I: Hashes +### ::::::::::::::::: +### sh -c "rm OPAM/repo/state-*.cache" +### OPAMDEBUGSECTIONS="opam-file" OPAMDEBUG=-2 opam list good-md5 -s | unordered +opam-file Missing expected extra files ../../../no-checksum/no-checksum.1/files/p.patch at ${BASEDIR}/OPAM/repo/default/packages/escape-good-md5/escape-good-md5.1/files +opam-file Missing extra-files field for p.patch for no-checksum.1, adding them. +opam-file Missing extra-files field for p.patch for not-mentioned.1, adding them. +opam-file Missing expected extra files p.patch at ${BASEDIR}/OPAM/repo/default/packages/not-present/not-present.1/files +opam-file Mismatching extra-files at ${BASEDIR}/OPAM/repo/default/packages/good-md5-good-sha256/good-md5-good-sha256.1: missing from 'files' directory (1) +opam-file Missing expected extra files /etc/passwdd at ${BASEDIR}/OPAM/repo/default/packages/escape-absolute/escape-absolute.1/files +opam-file Mismatching extra-files at ${BASEDIR}/OPAM/repo/default/packages/good-md5-bad-sha256/good-md5-bad-sha256.1: missing from 'files' directory (1) +opam-file Mismatching extra-files at ${BASEDIR}/OPAM/repo/default/packages/bad-md5/bad-md5.1: wrong checksum (1) +good-md5.1 +### :I:1: good md5 +### opam lint --package good-md5 +/good-md5.1: Passed. +### opam lint --package good-md5 --check-upstream +/good-md5.1: Passed. +### opam install good-md5 +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed good-md5.1 +Done. +### opam remove good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5.1 +Done. +### opam install good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed good-md5.1 +Done. +### opam source good-md5 +Successfully extracted to ${BASEDIR}/good-md5.1 +### test -f good-md5.1/p.patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:2: good md5 & sha256 +### opam lint --package good-md5-good-sha256 +/good-md5-good-sha256.1: Passed. +### opam lint --package good-md5-good-sha256 --check-upstream +/good-md5-good-sha256.1: Passed. +### opam install good-md5-good-sha256 +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed good-md5-good-sha256.1 +Done. +### opam remove good-md5-good-sha256 +The following actions will be performed: +=== remove 1 package + - remove good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5-good-sha256.1 +Done. +### opam install good-md5-good-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed good-md5-good-sha256.1 +Done. +### opam source good-md5-good-sha256 +Successfully extracted to ${BASEDIR}/good-md5-good-sha256.1 +### test -f good-md5-good-sha256.1/p.patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:3: bad md5 +### opam lint --package bad-md5 +/bad-md5.1: Errors. + error 53: Mismatching 'extra-files:' field: "p.patch" +# Return code 1 # +### opam lint --package bad-md5 --check-upstream +/bad-md5.1: Errors. + error 53: Mismatching 'extra-files:' field: "p.patch" +# Return code 1 # +### opam install bad-md5 +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/bad-md5/bad-md5.1/files/p.patch + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build bad-md5 1 ++- +- No changes have been performed +# Return code 31 # +### opam install bad-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/bad-md5/bad-md5.1/files/p.patch + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build bad-md5 1 ++- +- No changes have been performed +# Return code 31 # +### opam source bad-md5 | '.n"' -> '"' +[WARNING] Some errors extracting to ${BASEDIR}/bad-md5.1: Failure("Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/bad-md5/bad-md5.1/files/p.patch") + +### test -f bad-md5.1/p.patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:4: good md5 & bad sha256 +### opam lint --package good-md5-bad-sha256 +/good-md5-bad-sha256.1: Passed. +### opam lint --package good-md5-bad-sha256 --check-upstream +/good-md5-bad-sha256.1: Passed. +### opam install good-md5-bad-sha256 +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/good-md5-bad-sha256/good-md5-bad-sha256.1/files/p.patch + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 31 # +### opam install good-md5-bad-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/good-md5-bad-sha256/good-md5-bad-sha256.1/files/p.patch + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 31 # +### opam source good-md5-bad-sha256 | '.n"' -> '"' +[WARNING] Some errors extracting to ${BASEDIR}/good-md5-bad-sha256.1: Failure("Bad hash for - ${BASEDIR}/OPAM/repo/default/packages/good-md5-bad-sha256/good-md5-bad-sha256.1/files/p.patch") + +### test -f good-md5-bad-sha256.1/p.patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:5: no checksum +### opam lint --package no-checksum +/no-checksum.1: Errors. + error 3: File format error in 'extra-files' at line 11, column 2: expected [file checksum] +# Return code 1 # +### opam lint --package no-checksum --check-upstream +/no-checksum.1: Errors. + error 3: File format error in 'extra-files' at line 11, column 2: expected [file checksum] +# Return code 1 # +### # extra files is added with its checksum at repo loading +### opam install no-checksum +[ERROR] In the opam file for no-checksum.1: + - At ${BASEDIR}/OPAM/repo/default/packages/no-checksum/no-checksum.1/opam:11:2-11:13:: + expected [file checksum] + 'extra-files' has been ignored. +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed no-checksum.1 +Done. +### opam remove no-checksum +[ERROR] In the opam file for no-checksum.1: + - At ${BASEDIR}/OPAM/repo/default/packages/no-checksum/no-checksum.1/opam:11:2-11:13:: + expected [file checksum] + 'extra-files' has been ignored. +The following actions will be performed: +=== remove 1 package + - remove no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed no-checksum.1 +Done. +### opam install no-checksum --require-checksums +[ERROR] In the opam file for no-checksum.1: + - At ${BASEDIR}/OPAM/repo/default/packages/no-checksum/no-checksum.1/opam:11:2-11:13:: + expected [file checksum] + 'extra-files' has been ignored. +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed no-checksum.1 +Done. +### opam source no-checksum +Successfully extracted to ${BASEDIR}/no-checksum.1 +### test -f no-checksum.1/p.patch +### opam clean --download-cache +Clearing cache of downloaded files +### ::::::::::::::::: +### :II: Presence +### ::::::::::::::::: +### :II:1: not mentioned +### opam lint --package not-mentioned +/not-mentioned.1: Passed. +### opam lint --package not-mentioned --check-upstream +/not-mentioned.1: Passed. +### opam install not-mentioned +The following actions will be performed: +=== install 1 package + - install not-mentioned 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed not-mentioned.1 +Done. +### opam remove not-mentioned +The following actions will be performed: +=== remove 1 package + - remove not-mentioned 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed not-mentioned.1 +Done. +### opam install not-mentioned --require-checksums +The following actions will be performed: +=== install 1 package + - install not-mentioned 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed not-mentioned.1 +Done. +### opam source not-mentioned +Successfully extracted to ${BASEDIR}/not-mentioned.1 +### test -f not-mentioned.1/p.patch +### opam clean --download-cache +Clearing cache of downloaded files +### :II:2: not present +### opam lint --package not-present +/not-present.1: Errors. + error 53: Mismatching 'extra-files:' field: "p.patch" +# Return code 1 # +### opam lint --package not-present --check-upstream +/not-present.1: Errors. + error 53: Mismatching 'extra-files:' field: "p.patch" +# Return code 1 # +### opam install not-present +The following actions will be performed: +=== install 1 package + - install not-present 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Sys_error("${BASEDIR}/OPAM/repo/default/packages/not-present/not-present.1/files/p.patch: No such file or directory") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build not-present 1 ++- +- No changes have been performed +# Return code 31 # +### opam install not-present --require-checksums +The following actions will be performed: +=== install 1 package + - install not-present 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Sys_error("${BASEDIR}/OPAM/repo/default/packages/not-present/not-present.1/files/p.patch: No such file or directory") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build not-present 1 ++- +- No changes have been performed +# Return code 31 # +### opam source not-present +Fatal error: +Sys_error("${BASEDIR}/OPAM/repo/default/packages/not-present/not-present.1/files/p.patch: No such file or directory") +# Return code 99 # +### test -f not-present.1/p.patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### ::::::::::::::::: +### :III: Escaping +### ::::::::::::::::: +### :III:1: absolute +### opam lint --package escape-absolute +/escape-absolute.1: Errors. + error 53: Mismatching 'extra-files:' field: "/etc/passwdd" +# Return code 1 # +### opam lint --package escape-absolute --check-upstream +/escape-absolute.1: Errors. + error 53: Mismatching 'extra-files:' field: "/etc/passwdd" +# Return code 1 # +### opam install escape-absolute +The following actions will be performed: +=== install 1 package + - install escape-absolute 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Sys_error("${BASEDIR}/OPAM/repo/default/packages/escape-absolute/escape-absolute.1/files//etc/passwdd: No such file or directory") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build escape-absolute 1 ++- +- No changes have been performed +# Return code 31 # +### opam install escape-absolute --require-checksums +The following actions will be performed: +=== install 1 package + - install escape-absolute 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> + +Sys_error("${BASEDIR}/OPAM/repo/default/packages/escape-absolute/escape-absolute.1/files//etc/passwdd: No such file or directory") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build escape-absolute 1 ++- +- No changes have been performed +# Return code 31 # +### opam source escape-absolute +Fatal error: +Sys_error("${BASEDIR}/OPAM/repo/default/packages/escape-absolute/escape-absolute.1/files//etc/passwdd: No such file or directory") +# Return code 99 # +### test -f escape-absolute.1/p.patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :III:2: good md5 +### opam lint --package escape-good-md5 +/escape-good-md5.1: Errors. + error 53: Mismatching 'extra-files:' field: "../../../no-checksum/no-checksum.1/files/p.patch" +# Return code 1 # +### opam lint --package escape-good-md5 --check-upstream +/escape-good-md5.1: Errors. + error 53: Mismatching 'extra-files:' field: "../../../no-checksum/no-checksum.1/files/p.patch" +# Return code 1 # +### # ERROR it copies it to build dir ^ relative path -> escape!!!! +### # currently writing in /tmp as a common it copies in +### # /tmp/build_d2b6ce_dune/opam-reftest-8f9413/escape-good-md5.1/../../../no-checksum/no-checksum.1/files +### # This is needed for test portability, windows doesn't check path before resolving it +### mkdir ${BASEDIR}/OPAM/repo/default/packages/escape-good-md5/escape-good-md5.1/files +### opam install escape-good-md5 +The following actions will be performed: +=== install 1 package + - install escape-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] The compilation of escape-good-md5.1 failed at "test -f p.patch". + + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build escape-good-md5 1 ++- +- No changes have been performed +# Return code 31 # +### opam install escape-good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install escape-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] The compilation of escape-good-md5.1 failed at "test -f p.patch". + + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build escape-good-md5 1 ++- +- No changes have been performed +# Return code 31 # +### opam source escape-good-md5 +Successfully extracted to ${BASEDIR}/escape-good-md5.1 +### test -f escape-good-md5.1/p.patch +# Return code 1 # diff --git a/tests/reftests/extrasource.test b/tests/reftests/extrasource.test new file mode 100644 index 00000000000..f46207d1e0c --- /dev/null +++ b/tests/reftests/extrasource.test @@ -0,0 +1,1283 @@ +N0REP0 +### ::: Setup ::: +### +Trust me, im' a patch! +### openssl md5 p.patch | '.*= ' -> '' >$ PATCH_MD5 +### openssl sha256 p.patch | '.*= ' -> '' >$ PATCH_SHA256 +### sh -c "echo '$PATCH_MD5' | cut -c 1-2" >$ PRE_MD5 +### echo "$OPAMROOT/download-cache/md5/$PRE_MD5/$PATCH_MD5" >$ PATCH_MD5_PATH +### sh -c "echo '$PATCH_SHA256' | cut -c 1-2" >$ PRE_SHA256 +### echo "$OPAMROOT/download-cache/sha256/$PRE_SHA256/$PATCH_SHA256" >$ PATCH_SHA256_PATH +### +set -ue + +eval "MD5_PATH=\"$PATCH_MD5_PATH\"" +eval "SHA256_PATH=\"$PATCH_SHA256_PATH\"" + +if command -v cygpath 2> /dev/null > /dev/null ; then + MD5_PATH=`cygpath -u "$MD5_PATH"` + SHA256_PATH=`cygpath -u "$SHA256_PATH"` +fi + +check2sum () { + kind=$1 + path=$2 + hsh=`openssl "$kind" "$path" | cut -f 2 -d ' '` + name=`basename "$path"` + if [ "$name" = "$hsh" ]; then + echo "with matching checksum" + else + echo "with mismatching checksum" + fi +} +check () { + path=$1 + if [ -L "$path" ] ; then + out="link," + realpath=`realpath -mLP "$path"` + if [ "$realpath" = "$MD5_PATH" ]; then + out="$out to md5 patch" + elif [ "$realpath" = "$SHA256_PATH" ]; then + out="$out to sha256 patch" + else + out="$out to unknown path $realpath" + fi + elif [ -f "$path" ] ; then + out="patch," + if echo "$path" | grep -q md5 ; then + out="$out `check2sum md5 $path`" + elif echo "$path" | grep -q sha256 ; then + out="$out `check2sum sha256 $path`" + else + out="$out no checksum validation" + fi + else + out="not found" + fi + echo "$out" +} + +echo "MD5: $(check "$MD5_PATH")" +echo "SHA256: $(check "$SHA256_PATH")" +### +set -ue +pkg=$1 +pkgpath="REPO/packages/${pkg%.*}/$pkg" +if [ ! -d $pkgpath/files ] ; then + mkdir $pkgpath/files + cp p.patch $pkgpath/files/ +fi +### ::: Setup: extra-sources section ::: +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ "md5=patch-md5" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ "sha256=patch-sha256" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "md5=patch-md5" + "sha256=patch-sha256" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "sha256=patch-sha256" + "md5=patch-md5" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "md5=patch-md5" + "md5=00000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ "md5=00000000000000000000000000000000" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "md5=patch-md5" + "sha256=0000000000000000000000000000000000000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "sha256=patch-sha256" + "md5=00000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "Satan" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "A (less) very evil package" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ + "md5=00000000000000000000000000000000" + "md5=11111111111111111111111111111111" + "md5=22222222222222222222222222222222" + "md5=33333333333333333333333333333333" + "md5=44444444444444444444444444444444" + "md5=patch-md5" + "md5=55555555555555555555555555555555" + "md5=66666666666666666666666666666666" + "md5=77777777777777777777777777777777" + "md5=88888888888888888888888888888888" + "md5=99999999999999999999999999999999" + "md5=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "md5=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + "md5=cccccccccccccccccccccccccccccccc" + "md5=dddddddddddddddddddddddddddddddd" + "md5=eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" + "md5=ffffffffffffffffffffffffffffffff" + "sha256=0123456789abcdeffedcba98765432100123456789abcdeffedbca9876543210" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +### sh add-files.sh not-mentioned.1 +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "i-am-a-patch" ] +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ "md5=patch-md5" ] +} +extra-source "i-am-a-patch" { + src:"p.patch" + checksum: [ "md5=patch-md5" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +extra-source "/etc/passwd" { + src:"p.patch" + checksum: "md5=patch-md5" +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +extra-source "../../../../../shouldnt-exist" { + src:"p.patch" + checksum: [ "md5=patch-md5" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +extra-source "../shouldnt-exist" { + src:"p.patch" + checksum: [ "md5=patch-md5" ] +} +### +set -ue + +for p in `ls REPO/packages/*/*/opam`; do + sed -i.bak "s/patch-md5/$PATCH_MD5/" $p + sed -i.bak "s/patch-sha256/$PATCH_SHA256/" $p +done +### sh update-hashes.sh +### opam update default + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[default] synchronised from file://${BASEDIR}/REPO +Now run 'opam upgrade' to apply any package updates. +### ::: End setup ::: +### opam switch create --empty robur +### OPAMSTRICT=no +### ::::::::::::::::: +### :I: Hashes +### ::::::::::::::::: +### :I:1: good md5 +### opam lint --package good-md5 +/good-md5.1: Passed. +### opam lint --package good-md5 --check-upstream +/good-md5.1: Passed. +### opam install good-md5 +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> installed good-md5.1 +Done. +### opam remove good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5.1 +Done. +### opam install good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (cached) +-> installed good-md5.1 +Done. +### opam source good-md5 +Successfully extracted to ${BASEDIR}/good-md5.1 +### opam clean --download-cache +Clearing cache of downloaded files +### test -f good-md5.1/i-am-a-patch +### :I:2: good sha256 +### opam lint --package good-sha256 +/good-sha256.1: Passed. +### opam lint --package good-sha256 --check-upstream +/good-sha256.1: Passed. +### opam install good-sha256 +The following actions will be performed: +=== install 1 package + - install good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/p.patch) +-> installed good-sha256.1 +Done. +### opam remove good-sha256 +The following actions will be performed: +=== remove 1 package + - remove good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256.1 +Done. +### opam install good-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (cached) +-> installed good-sha256.1 +Done. +### opam source good-sha256 +Successfully extracted to ${BASEDIR}/good-sha256.1 +### test -f good-sha256.1/i-am-a-patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:3: good md5 & sha256 +### opam lint --package good-md5-good-sha256 +/good-md5-good-sha256.1: Passed. +### opam lint --package good-md5-good-sha256 --check-upstream +/good-md5-good-sha256.1: Passed. +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam install good-md5-good-sha256 +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5-good-sha256.1 (cached) +-> installed good-md5-good-sha256.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam remove good-md5-good-sha256 +The following actions will be performed: +=== remove 1 package + - remove good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5-good-sha256.1 +Done. +### opam install good-md5-good-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5-good-sha256.1 (cached) +-> installed good-md5-good-sha256.1 +Done. +### opam source good-md5-good-sha256 +Successfully extracted to ${BASEDIR}/good-md5-good-sha256.1 +### test -f good-md5-good-sha256.1/i-am-a-patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:4: good sha256 & good md5 +### opam lint --package good-sha256-good-md5 +/good-sha256-good-md5.1: Passed. +### opam lint --package good-sha256-good-md5 --check-upstream +/good-sha256-good-md5.1: Passed. +### opam clean --download-cache +Clearing cache of downloaded files +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### opam install good-sha256-good-md5 +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam remove good-sha256-good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256-good-md5.1 +Done. +### opam install good-sha256-good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> installed good-sha256-good-md5.1 +Done. +### opam source good-sha256-good-md5 +Successfully extracted to ${BASEDIR}/good-sha256-good-md5.1 +### test -f good-sha256-good-md5.1/i-am-a-patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:5: no checksum +### opam lint --package no-checksum +/no-checksum.1: Passed. +### opam lint --package no-checksum --check-upstream +/no-checksum.1: Passed. +### opam install no-checksum +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved no-checksum.1 (file://${BASEDIR}/p.patch) +-> installed no-checksum.1 +Done. +### opam remove no-checksum +The following actions will be performed: +=== remove 1 package + - remove no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed no-checksum.1 +Done. +### opam install no-checksum --require-checksums +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved no-checksum.1 (file://${BASEDIR}/p.patch) + +no-checksum.1/i-am-a-patch: Missing checksum, and `--require-checksums` was set. + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build no-checksum 1 ++- +- No changes have been performed +# Return code 31 # +### opam source no-checksum +Successfully extracted to ${BASEDIR}/no-checksum.1 +### test -f no-checksum.1/i-am-a-patch +### opam clean --download-cache +Clearing cache of downloaded files +### :I:6: multiple md5 +### opam lint --package multiple-md5 +/multiple-md5.1: Passed. +### opam lint --package multiple-md5 --check-upstream +/multiple-md5.1: Passed. +### opam install multiple-md5 | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install multiple-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] multiple-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of multiple-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch multiple-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install multiple-md5 --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install multiple-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] multiple-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of multiple-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch multiple-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source multiple-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] multiple-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f multiple-md5.1/i-am-a-patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:7: bad md5 +### opam lint --package bad-md5 +/bad-md5.1: Passed. +### opam lint --package bad-md5 --check-upstream +/bad-md5.1: Passed. +### opam install bad-md5 | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install bad-md5 --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source bad-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f bad-md5.1/i-am-a-patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:8: good md5 & bad sha256 +### opam lint --package good-md5-bad-sha256 +/good-md5-bad-sha256.1: Passed. +### opam lint --package good-md5-bad-sha256 --check-upstream +/good-md5-bad-sha256.1: Passed. +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam install good-md5-bad-sha256 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (match) + - sha256=hash (MISMATCH) + +[ERROR] good-md5-bad-sha256.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get extra source "i-am-a-patch" of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: not found +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### opam reinstall good-sha256 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/p.patch) +-> removed good-sha256.1 +-> installed good-sha256.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: patch, with matching checksum +### opam install good-md5-bad-sha256 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (match) + - sha256=hash (MISMATCH) + +[ERROR] good-md5-bad-sha256.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get extra source "i-am-a-patch" of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: patch, with matching checksum +### opam install good-md5-bad-sha256 --require-checksums | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-md5-bad-sha256.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get extra source "i-am-a-patch" of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### opam source good-md5-bad-sha256 | '[0-9a-z]{64}' -> 'md5' +[ERROR] good-md5-bad-sha256.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected sha256=md5 + got sha256=md5 +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f good-md5-bad-sha256.1/i-am-a-patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:9: good sha256 & bad md5 +### opam lint --package good-sha256-bad-md5 +/good-sha256-bad-md5.1: Passed. +### opam lint --package good-sha256-bad-md5 --check-upstream +/good-sha256-bad-md5.1: Passed. +### opam install good-sha256-bad-md5 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-sha256-bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of good-sha256-bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-sha256-bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install good-sha256-bad-md5 --require-checksums | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-sha256-bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of good-sha256-bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-sha256-bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source good-sha256-bad-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] good-sha256-bad-md5.1/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f good-sha256-bad-md5.1/i-am-a-patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:10: clash with all md5 +### opam lint --package clash-with-all-md5s +/clash-with-all-md5s.666: Passed. +### opam lint --package clash-with-all-md5s --check-upstream +/clash-with-all-md5s.666: Passed. +### opam install clash-with-all-md5s | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] clash-with-all-md5s.666/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: not found +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### opam reinstall good-sha256 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/p.patch) +-> removed good-sha256.1 +-> installed good-sha256.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: patch, with matching checksum +### opam install clash-with-all-md5s | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (match) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - sha256=hash0123456789abcdeffedbca9876543210 (MISMATCH) + +[ERROR] clash-with-all-md5s.666/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: patch, with matching checksum +### opam install clash-with-all-md5s --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] clash-with-all-md5s.666/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Failed to get extra source "i-am-a-patch" of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### opam source clash-with-all-md5s | '[0-9a-z]{32}' -> 'hash' +[ERROR] clash-with-all-md5s.666/i-am-a-patch: Checksum mismatch for file://${BASEDIR}/p.patch: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f clash-with-all-md5s.666/i-am-a-patch +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### ::::::::::::::::: +### :II: Presence +### ::::::::::::::::: +### :II:1: not mentioned +### opam lint --package not-mentioned +/not-mentioned.1: Passed. +### opam lint --package not-mentioned --check-upstream +/not-mentioned.1: Passed. +### opam install not-mentioned +The following actions will be performed: +=== install 1 package + - install not-mentioned 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] The compilation of not-mentioned.1 failed at "test -f i-am-a-patch". + + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build not-mentioned 1 ++- +- No changes have been performed +# Return code 31 # +### opam remove not-mentioned +[NOTE] not-mentioned is not installed. + +Nothing to do. +### opam install not-mentioned --require-checksums +The following actions will be performed: +=== install 1 package + - install not-mentioned 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] The compilation of not-mentioned.1 failed at "test -f i-am-a-patch". + + + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - build not-mentioned 1 ++- +- No changes have been performed +# Return code 31 # +### opam source not-mentioned +Successfully extracted to ${BASEDIR}/not-mentioned.1 +### test -f not-mentioned.1/i-am-a-patch +# Return code 1 # +### :II:2: Double extra-source +### opam lint --package multiple +/multiple.1: Errors. + error 3: File format error in 'extra-source': Duplicate section extra-source +# Return code 1 # +### opam lint --package multiple --check-upstream +/multiple.1: Errors. + error 3: File format error in 'extra-source': Duplicate section extra-source +# Return code 1 # +### opam install multiple +[ERROR] In the opam file for multiple.1: + - In ${BASEDIR}/OPAM/repo/default/packages/multiple/multiple.1/opam: + Duplicate section extra-source + 'extra-source' has been ignored. +The following actions will be performed: +=== install 1 package + - install multiple 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved multiple.1 (file://${BASEDIR}/p.patch) +-> installed multiple.1 +Done. +### opam remove multiple +[ERROR] In the opam file for multiple.1: + - In ${BASEDIR}/OPAM/repo/default/packages/multiple/multiple.1/opam: + Duplicate section extra-source + 'extra-source' has been ignored. +The following actions will be performed: +=== remove 1 package + - remove multiple 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed multiple.1 +Done. +### opam install multiple --require-checksums +[ERROR] In the opam file for multiple.1: + - In ${BASEDIR}/OPAM/repo/default/packages/multiple/multiple.1/opam: + Duplicate section extra-source + 'extra-source' has been ignored. +The following actions will be performed: +=== install 1 package + - install multiple 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved multiple.1 (cached) +-> installed multiple.1 +Done. +### opam source multiple +Successfully extracted to ${BASEDIR}/multiple.1 +### test -f multiple.1/i-am-a-patch +### ::::::::::::::::: +### :III: Cache manipulation +### ::::::::::::::::: +### :III:1: install with removed md5 frome cache, and kept sha256 +### rm "$PATCH_MD5_PATH" +### opam reinstall good-sha256 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/p.patch) +-> removed good-sha256.1 +-> installed good-sha256.1 +Done. +### sh check-cache.sh +MD5: not found +SHA256: patch, with matching checksum +### opam reinstall good-sha256-good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> removed good-sha256-good-md5.1 +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: not found +SHA256: patch, with matching checksum +### opam clean --download-cache +Clearing cache of downloaded files +### :III:2: install with removed sha256 frome cache, and kept md5 +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/p.patch) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam reinstall good-sha256-good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> removed good-sha256-good-md5.1 +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### :III:c: corrupt md5 patch in cache +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: not found +### opam remove good-sha256-good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256-good-md5.1 +Done. +### cp check-cache.sh "$PATCH_MD5_PATH" +### sh check-cache.sh +MD5: patch, with mismatching checksum +SHA256: not found +### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - sha256=hash (MISMATCH) + - md5=hash (MISMATCH) + +-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/p.patch) +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: link, to sha256 patch +SHA256: patch, with matching checksum +### :III:4: corrupt sha256 patch in cache +### sh check-cache.sh +MD5: link, to sha256 patch +SHA256: patch, with matching checksum +### opam remove good-sha256-good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256-good-md5.1 +Done. +### rm "$PATCH_MD5_PATH" "$PATCH_SHA256_PATH" +### cp p.patch "$PATCH_MD5_PATH" +### cp check-cache.sh "$PATCH_SHA256_PATH" +### sh check-cache.sh +MD5: patch, with matching checksum +SHA256: patch, with mismatching checksum +### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - sha256=hash (MISMATCH) + - md5=hash (MISMATCH) + +-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/p.patch) +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: link, to sha256 patch +SHA256: patch, with matching checksum +### :III:5: Both corrupted +### opam remove good-sha256-good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256-good-md5.1 +Done. +### rm "$PATCH_MD5_PATH" "$PATCH_SHA256_PATH" +### cp check-cache.sh "$PATCH_MD5_PATH" +### cp check-cache.sh "$PATCH_SHA256_PATH" +### sh check-cache.sh +MD5: patch, with mismatching checksum +SHA256: patch, with mismatching checksum +### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - sha256=hash (MISMATCH) + - md5=hash (MISMATCH) + +-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/p.patch) +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: link, to sha256 patch +SHA256: patch, with matching checksum +### opam clean --download-cache +Clearing cache of downloaded files +### ::::::::::::::::: +### :IV: Escaping +### ::::::::::::::::: +### :IV:1: absolute +### opam lint --package escape-absolute +/escape-absolute.1: Passed. +### opam lint --package escape-absolute --check-upstream +/escape-absolute.1: Passed. +### opam install escape-absolute +The following actions will be performed: +=== install 1 package + - install escape-absolute 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved escape-absolute.1 (file://${BASEDIR}/p.patch) +-> installed escape-absolute.1 +Done. +### opam install escape-absolute --require-checksums +[NOTE] Package escape-absolute is already installed (current version is 1). +### opam source escape-absolute +Successfully extracted to ${BASEDIR}/escape-absolute.1 +### test -f escape-absolute.1/etc/passwd +### :IV:2: good md5 +### # /!\ all escape!!! +### opam lint --package escape-build-good-md5 +/escape-build-good-md5.1: Passed. +### opam lint --package escape-build-good-md5 --check-upstream +/escape-build-good-md5.1: Passed. +### opam install escape-build-good-md5 +The following actions will be performed: +=== install 1 package + - install escape-build-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved escape-build-good-md5.1 (cached) +-> installed escape-build-good-md5.1 +Done. +### test -f shouldnt-exist +### rm shouldnt-exist +### opam remove escape-build-good-md5 +The following actions will be performed: +=== remove 1 package + - remove escape-build-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed escape-build-good-md5.1 +Done. +### opam install escape-build-good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install escape-build-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved escape-build-good-md5.1 (cached) +-> installed escape-build-good-md5.1 +Done. +### test -f shouldnt-exist +### rm shouldnt-exist +### opam source escape-source-good-md5 +Successfully extracted to ${BASEDIR}/escape-source-good-md5.1 +### test -f shouldnt-exist From c83007388ab05965eac73f98feb591287d41ad4c Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:36:34 +0200 Subject: [PATCH 03/13] reftest: local-cache, remove need for patch file --- tests/reftests/local-cache.test | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 70885f29490..a70186a5d86 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -3,12 +3,8 @@ N0REP0 ### Hi robur! ### tar czf archive.tgz hello -### -Trust me, im' a patch! ### openssl md5 archive.tgz | '.*= ' -> '' >$ ARCHIVE_MD5 ### openssl sha256 archive.tgz | '.*= ' -> '' >$ ARCHIVE_SHA256 -### openssl md5 p.patch | '.*= ' -> '' >$ PATCH_MD5 -### openssl sha256 p.patch | '.*= ' -> '' >$ PATCH_SHA256 ### sh -c "echo '$ARCHIVE_MD5' | cut -c 1-2" >$ PRE_MD5 ### echo "$OPAMROOT/download-cache/md5/$PRE_MD5/$ARCHIVE_MD5" >$ ARCHIVE_MD5_PATH ### sh -c "echo '$ARCHIVE_SHA256' | cut -c 1-2" >$ PRE_SHA256 @@ -202,7 +198,7 @@ The following actions will be performed: -> removed good-sha256-good-md5.1 Done. ### rm "$ARCHIVE_MD5_PATH" -### tar czf "$ARCHIVE_MD5_PATH" p.patch +### tar czf "$ARCHIVE_MD5_PATH" check-cache.sh ### sh check-cache.sh MD5: archive, with mismatching checksum SHA256: archive, with matching checksum @@ -233,7 +229,7 @@ The following actions will be performed: Done. ### cp archive.tgz "$ARCHIVE_MD5_PATH" ### rm "$ARCHIVE_SHA256_PATH" -### tar czf "$ARCHIVE_SHA256_PATH" p.patch +### tar czf "$ARCHIVE_SHA256_PATH" check-cache.sh ### sh check-cache.sh MD5: archive, with matching checksum SHA256: archive, with mismatching checksum @@ -264,9 +260,9 @@ The following actions will be performed: -> removed good-sha256-good-md5.1 Done. ### rm "$ARCHIVE_SHA256_PATH" -### tar czf "$ARCHIVE_SHA256_PATH" p.patch +### tar czf "$ARCHIVE_SHA256_PATH" check-cache.sh ### rm "$ARCHIVE_MD5_PATH" -### tar czf "$ARCHIVE_MD5_PATH" p.patch +### tar czf "$ARCHIVE_MD5_PATH" check-cache.sh ### sh check-cache.sh MD5: archive, with mismatching checksum SHA256: archive, with mismatching checksum @@ -353,7 +349,7 @@ The following actions will be performed: -> removed good-sha256.1 Done. ### rm "$ARCHIVE_SHA256_PATH" -### tar czf "$ARCHIVE_SHA256_PATH" p.patch +### tar czf "$ARCHIVE_SHA256_PATH" check-cache.sh ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with mismatching checksum From 77f21df02192f7d33e162dc2876dcef3e3779213 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:38:50 +0200 Subject: [PATCH 04/13] reftest: local-cache, simplify var names in script --- tests/reftests/local-cache.test | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index a70186a5d86..f8762a139fc 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -11,12 +11,13 @@ Hi robur! ### echo "$OPAMROOT/download-cache/sha256/$PRE_SHA256/$ARCHIVE_SHA256" >$ ARCHIVE_SHA256_PATH ### set -ue -eval "ARCHIVE_MD5_PATH=\"$ARCHIVE_MD5_PATH\"" -eval "ARCHIVE_SHA256_PATH=\"$ARCHIVE_SHA256_PATH\"" + +eval "MD5_PATH=\"$ARCHIVE_MD5_PATH\"" +eval "SHA256_PATH=\"$ARCHIVE_SHA256_PATH\"" if command -v cygpath 2> /dev/null > /dev/null ; then - ARCHIVE_MD5_PATH=`cygpath -u "$ARCHIVE_MD5_PATH"` - ARCHIVE_SHA256_PATH=`cygpath -u "$ARCHIVE_SHA256_PATH"` + MD5_PATH=`cygpath -u "$MD5_PATH"` + SHA256_PATH=`cygpath -u "$SHA256_PATH"` fi check2sum () { @@ -35,9 +36,9 @@ check () { if [ -L "$path" ] ; then out="link," realpath=`readlink -f "$path"` || true - if [ "$realpath" = "$ARCHIVE_MD5_PATH" ]; then + if [ "$realpath" = "$MD5_PATH" ]; then out="$out to md5 archive" - elif [ "$realpath" = "$ARCHIVE_SHA256_PATH" ]; then + elif [ "$realpath" = "$SHA256_PATH" ]; then out="$out to sha256 archive" else out="$out to unknown path $realpath" @@ -57,8 +58,9 @@ check () { echo "$out" } -md5=$(check "$ARCHIVE_MD5_PATH") -sha256=$(check "$ARCHIVE_SHA256_PATH") +md5=$(check "$MD5_PATH") +sha256=$(check "$SHA256_PATH") + echo "MD5: $md5" echo "SHA256: $sha256" ### From e39b042742d223687425a529159bb9517af26266 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:43:46 +0200 Subject: [PATCH 05/13] reftest: local-cache, simplify update hashes --- tests/reftests/local-cache.test | 34 ++++++++++----------------------- 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index f8762a139fc..0d6a88bc91a 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -63,27 +63,6 @@ sha256=$(check "$SHA256_PATH") echo "MD5: $md5" echo "SHA256: $sha256" -### -set -ue -pkg=$1 -kind=$2 -hsh=$3 -case "$hsh-$kind" in - md5-archive) - HSH=$ARCHIVE_MD5 - break;; - sha256-archive) - HSH=$ARCHIVE_SHA256 - break;; - md5-patch) - HSH=$PATCH_MD5 - break;; - sha256-patch) - HSH=$PATCH_SHA256 - break;; -esac -pkgpath="REPO/packages/${pkg%.*}/$pkg" -sed -i.bak "s/good-$hsh/$HSH/" "$pkgpath/opam" ### opam-version: "2.0" maintainer: "nobody" @@ -101,13 +80,20 @@ url { "md5=good-md5" ] } -### sh update-hash.sh good-sha256-good-md5.1 archive md5 -### sh update-hash.sh good-sha256-good-md5.1 archive sha256 +### +set -ue + +for p in `ls REPO/packages/*/*/opam`; do + sed -i.bak "s/good-md5/$ARCHIVE_MD5/" $p + sed -i.bak "s/good-sha256/$ARCHIVE_SHA256/" $p +done +### sh update-hashes.sh ### opam update <><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> [default] synchronised from file://${BASEDIR}/REPO Now run 'opam upgrade' to apply any package updates. +### ::: End setup ::: ### opam switch create default --empty ### :I:11: Change archive in cache ### :I:11:a: install with removed md5 frome cache, and kept sha256 @@ -300,7 +286,7 @@ url { "sha256=good-sha256" ] } -### sh update-hash.sh good-sha256.1 archive sha256 +### sh update-hashes.sh ### opam update <><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> From 3109a0bd4d0cc5d6432f05f022922e8fbf335da6 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:45:05 +0200 Subject: [PATCH 06/13] reftest: local-cache, change sed variable name --- tests/reftests/local-cache.test | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 0d6a88bc91a..0c58ed07b3b 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -76,16 +76,16 @@ build: [ "test" "-f" "hello" ] url { src: "archive.tgz" checksum: [ - "sha256=good-sha256" - "md5=good-md5" + "sha256=archive-sha256" + "md5=archive-md5" ] } ### set -ue for p in `ls REPO/packages/*/*/opam`; do - sed -i.bak "s/good-md5/$ARCHIVE_MD5/" $p - sed -i.bak "s/good-sha256/$ARCHIVE_SHA256/" $p + sed -i.bak "s/archive-md5/$ARCHIVE_MD5/" $p + sed -i.bak "s/archive-sha256/$ARCHIVE_SHA256/" $p done ### sh update-hashes.sh ### opam update @@ -283,7 +283,7 @@ build: [ "test" "-f" "hello" ] url { src: "archive.tgz" checksum: [ - "sha256=good-sha256" + "sha256=archive-sha256" ] } ### sh update-hashes.sh From 9985c7e0c0c36edfeb4d80d51302cdbc1a9e97a9 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:59:06 +0200 Subject: [PATCH 07/13] reftest: local-cache, gather setup --- tests/reftests/local-cache.test | 39 ++++++++++++--------------------- 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 0c58ed07b3b..1098a9db382 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -63,6 +63,20 @@ sha256=$(check "$SHA256_PATH") echo "MD5: $md5" echo "SHA256: $sha256" +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ "sha256=archive-sha256" ] +} ### opam-version: "2.0" maintainer: "nobody" @@ -270,31 +284,6 @@ Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum -### -opam-version: "2.0" -maintainer: "nobody" -authors: "nobody neither" -homepage: "https://no.bo.dy" -bug-reports: "https://still.nobo.dy" -dev-repo: "git+https://no.were" -license: "MIT" -synopsis: "Initially empty" -build: [ "test" "-f" "hello" ] -url { - src: "archive.tgz" - checksum: [ - "sha256=archive-sha256" - ] -} -### sh update-hashes.sh -### opam update - -<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> -[default] synchronised from file://${BASEDIR}/REPO -Now run 'opam upgrade' to apply any package updates. -### sh check-cache.sh -MD5: link, to sha256 archive -SHA256: archive, with matching checksum ### opam install good-sha256.1 The following actions will be performed: === install 1 package From edb97c23a4690a281262bdd980c66ce947582140 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 10:59:13 +0200 Subject: [PATCH 08/13] reftest: local-cache, update heading --- tests/reftests/local-cache.test | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 1098a9db382..4e7b9eb7261 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -63,6 +63,7 @@ sha256=$(check "$SHA256_PATH") echo "MD5: $md5" echo "SHA256: $sha256" +### ::: Setup: archives in url section ::: ### opam-version: "2.0" maintainer: "nobody" @@ -108,9 +109,11 @@ done [default] synchronised from file://${BASEDIR}/REPO Now run 'opam upgrade' to apply any package updates. ### ::: End setup ::: -### opam switch create default --empty -### :I:11: Change archive in cache -### :I:11:a: install with removed md5 frome cache, and kept sha256 +### opam switch create robur --empty +### ::::::::::::::::: +### :II: Cache manipulation +### ::::::::::::::::: +### :II:1: install with removed md5 frome cache, and kept sha256 ### opam install good-sha256-good-md5 The following actions will be performed: === install 1 package @@ -147,7 +150,7 @@ Done. ### sh check-cache.sh MD5: not found SHA256: archive, with matching checksum -### :I:11:b: install with removed sha256 frome cache, and kept md5 +### :II:2: install with removed sha256 frome cache, and kept md5 ### opam clean --download-cache Clearing cache of downloaded files ### opam reinstall good-sha256-good-md5 @@ -187,7 +190,7 @@ Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum -### :I:11:c: corrupt md5 archive in cache +### :II:3: corrupt md5 archive in cache ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum @@ -217,7 +220,7 @@ Done. ### sh check-cache.sh MD5: archive, with mismatching checksum SHA256: archive, with matching checksum -### :I:11:d: corrupt sha256 archive in cache +### :II:4: corrupt sha256 archive in cache ### sh check-cache.sh MD5: archive, with mismatching checksum SHA256: archive, with matching checksum @@ -252,7 +255,7 @@ Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum -### :I:11:e: Both corrupted +### :II:5: Both corrupted ### opam remove good-sha256-good-md5 The following actions will be performed: === remove 1 package @@ -284,6 +287,7 @@ Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum +### :II:6: Corrupt linked archive ### opam install good-sha256.1 The following actions will be performed: === install 1 package From ec89c0af06c4b255545e449cf966e172e2156e09 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 11:02:54 +0200 Subject: [PATCH 09/13] reftest: local-cache, clean before new test --- tests/reftests/local-cache.test | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 4e7b9eb7261..c92164e7164 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -150,9 +150,9 @@ Done. ### sh check-cache.sh MD5: not found SHA256: archive, with matching checksum -### :II:2: install with removed sha256 frome cache, and kept md5 ### opam clean --download-cache Clearing cache of downloaded files +### :II:2: install with removed sha256 frome cache, and kept md5 ### opam reinstall good-sha256-good-md5 The following actions will be performed: === recompile 1 package @@ -287,7 +287,19 @@ Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum +### opam clean --download-cache +Clearing cache of downloaded files ### :II:6: Corrupt linked archive +### opam reinstall good-sha256-good-md5.1 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-sha256-good-md5.1 +-> installed good-sha256-good-md5.1 +Done. ### opam install good-sha256.1 The following actions will be performed: === install 1 package From d56f05db948ed7ebe9609ac2ce71ea174efda07d Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 11:08:53 +0200 Subject: [PATCH 10/13] reftest: local-cache, use realpath instead of readlink --- tests/reftests/local-cache.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index c92164e7164..8aebd0761be 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -35,7 +35,7 @@ check () { path=$1 if [ -L "$path" ] ; then out="link," - realpath=`readlink -f "$path"` || true + realpath=`realpath -mLP "$path"` if [ "$realpath" = "$MD5_PATH" ]; then out="$out to md5 archive" elif [ "$realpath" = "$SHA256_PATH" ]; then From 84bc52b8b64d350368bbcc73bef545bde86f52a5 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 11:10:33 +0200 Subject: [PATCH 11/13] reftest: local-cache, remove temp variable in check cache script --- tests/reftests/local-cache.test | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/reftests/local-cache.test b/tests/reftests/local-cache.test index 8aebd0761be..021e48be212 100644 --- a/tests/reftests/local-cache.test +++ b/tests/reftests/local-cache.test @@ -58,11 +58,8 @@ check () { echo "$out" } -md5=$(check "$MD5_PATH") -sha256=$(check "$SHA256_PATH") - -echo "MD5: $md5" -echo "SHA256: $sha256" +echo "MD5: $(check "$MD5_PATH")" +echo "SHA256: $(check "$SHA256_PATH")" ### ::: Setup: archives in url section ::: ### opam-version: "2.0" From bc7c689b9c27aeb68eda5a8ca116bce6ae03aaa0 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 11:17:36 +0200 Subject: [PATCH 12/13] reftest: move local-cache to archive --- master_changes.md | 1 + .../{local-cache.test => archive.test} | 0 tests/reftests/dune.inc | 36 +++++++++---------- 3 files changed, 19 insertions(+), 18 deletions(-) rename tests/reftests/{local-cache.test => archive.test} (100%) diff --git a/master_changes.md b/master_changes.md index c8284582474..fe6124039c5 100644 --- a/master_changes.md +++ b/master_changes.md @@ -103,6 +103,7 @@ users) ### Tests * Lint: add test for W53, to test extra file with good hash [#5639 @rjbou] * Add several checksum & cache validation checks for extra-source section, and extra-file field [#5560 @rjbou] + * Move local-cache into archive-field-checks test [#5560 @rjbou] ### Engine diff --git a/tests/reftests/local-cache.test b/tests/reftests/archive.test similarity index 100% rename from tests/reftests/local-cache.test rename to tests/reftests/archive.test diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index 6a400de054e..f2d47a3e02a 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -17,6 +17,24 @@ %{targets} (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:admin.test} %{read-lines:testing-env})))) +(rule + (alias reftest-archive) + (action + (diff archive.test archive.out))) + +(alias + (name reftest) + (deps (alias reftest-archive))) + +(rule + (targets archive.out) + (deps root-N0REP0) + (package opam) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:archive.test} %{read-lines:testing-env})))) + (rule (alias reftest-assume-built) (action @@ -728,24 +746,6 @@ %{targets} (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:list.unix.test} %{read-lines:testing-env})))) -(rule - (alias reftest-local-cache) - (action - (diff local-cache.test local-cache.out))) - -(alias - (name reftest) - (deps (alias reftest-local-cache))) - -(rule - (targets local-cache.out) - (deps root-N0REP0) - (package opam) - (action - (with-stdout-to - %{targets} - (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:local-cache.test} %{read-lines:testing-env})))) - (rule (alias reftest-lock) (action From f8ffbbe4e3dc1644f1c2b56a059b1208e664f4cd Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Fri, 25 Aug 2023 11:23:17 +0200 Subject: [PATCH 13/13] reftest: archive, add archive checksums & command tests --- master_changes.md | 2 +- tests/reftests/archive.test | 830 +++++++++++++++++++++++++++++++++++- 2 files changed, 820 insertions(+), 12 deletions(-) diff --git a/master_changes.md b/master_changes.md index fe6124039c5..65e46b140c3 100644 --- a/master_changes.md +++ b/master_changes.md @@ -102,7 +102,7 @@ users) ## Reftests ### Tests * Lint: add test for W53, to test extra file with good hash [#5639 @rjbou] - * Add several checksum & cache validation checks for extra-source section, and extra-file field [#5560 @rjbou] + * Add several checksum & cache validation checks for archive, extra-source section, and extra-file field [#5560 @rjbou] * Move local-cache into archive-field-checks test [#5560 @rjbou] ### Engine diff --git a/tests/reftests/archive.test b/tests/reftests/archive.test index 021e48be212..69c2eaac0e3 100644 --- a/tests/reftests/archive.test +++ b/tests/reftests/archive.test @@ -61,6 +61,20 @@ check () { echo "MD5: $(check "$MD5_PATH")" echo "SHA256: $(check "$SHA256_PATH")" ### ::: Setup: archives in url section ::: +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ "md5=archive-md5" ] +} ### opam-version: "2.0" maintainer: "nobody" @@ -75,6 +89,23 @@ url { src: "archive.tgz" checksum: [ "sha256=archive-sha256" ] } +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ + "md5=archive-md5" + "sha256=archive-sha256" + ] +} ### opam-version: "2.0" maintainer: "nobody" @@ -92,6 +123,115 @@ url { "md5=archive-md5" ] } +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { src: "archive.tgz" } +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ + "md5=archive-md5" + "md5=00000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ "md5=00000000000000000000000000000000" ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ + "md5=archive-md5" + "sha256=0000000000000000000000000000000000000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "nobody" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "Initially empty" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ + "sha256=archive-sha256" + "md5=00000000000000000000000000000000" + ] +} +### +opam-version: "2.0" +maintainer: "Satan" +authors: "nobody neither" +homepage: "https://no.bo.dy" +bug-reports: "https://still.nobo.dy" +dev-repo: "git+https://no.were" +license: "MIT" +synopsis: "A (less) very evil package" +build: [ "test" "-f" "hello" ] +url { + src: "archive.tgz" + checksum: [ + "md5=00000000000000000000000000000000" + "md5=11111111111111111111111111111111" + "md5=22222222222222222222222222222222" + "md5=33333333333333333333333333333333" + "md5=44444444444444444444444444444444" + "md5=archive-md5" + "md5=55555555555555555555555555555555" + "md5=66666666666666666666666666666666" + "md5=77777777777777777777777777777777" + "md5=88888888888888888888888888888888" + "md5=99999999999999999999999999999999" + "md5=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + "md5=bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" + "md5=cccccccccccccccccccccccccccccccc" + "md5=dddddddddddddddddddddddddddddddd" + "md5=eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" + "md5=ffffffffffffffffffffffffffffffff" + "sha256=0123456789abcdeffedcba98765432100123456789abcdeffedbca9876543210" + ] +} ### set -ue @@ -107,17 +247,694 @@ done Now run 'opam upgrade' to apply any package updates. ### ::: End setup ::: ### opam switch create robur --empty +### OPAMSTRICT=no ### ::::::::::::::::: -### :II: Cache manipulation +### :I: Url hashes ### ::::::::::::::::: -### :II:1: install with removed md5 frome cache, and kept sha256 +### :I:1: good md5 +### opam lint --package good-md5 +/good-md5.1: Passed. +### opam lint --package good-md5 --check-upstream +/good-md5.1: Passed. +### opam install good-md5 +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> installed good-md5.1 +Done. +### opam remove good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5.1 +Done. +### opam install good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (cached) +-> installed good-md5.1 +Done. +### opam source good-md5 +Successfully extracted to ${BASEDIR}/good-md5.1 +### test -f good-md5.1/hello +### opam clean --download-cache +Clearing cache of downloaded files +### :I:2: good sha256 +### opam lint --package good-sha256 +/good-sha256.1: Passed. +### opam lint --package good-sha256 --check-upstream +/good-sha256.1: Passed. +### opam install good-sha256 +The following actions will be performed: +=== install 1 package + - install good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/archive.tgz) +-> installed good-sha256.1 +Done. +### opam remove good-sha256 +The following actions will be performed: +=== remove 1 package + - remove good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256.1 +Done. +### opam install good-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (cached) +-> installed good-sha256.1 +Done. +### opam source good-sha256 +Successfully extracted to ${BASEDIR}/good-sha256.1 +### test -f good-sha256.1/hello +### opam clean --download-cache +Clearing cache of downloaded files +### :I:3: good md5 & sha256 +### opam lint --package good-md5-good-sha256 +/good-md5-good-sha256.1: Passed. +### opam lint --package good-md5-good-sha256 --check-upstream +/good-md5-good-sha256.1: Passed. +### opam clean --download-cache +Clearing cache of downloaded files +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: not found +### opam install good-md5-good-sha256 +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5-good-sha256.1 (cached) +-> installed good-md5-good-sha256.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: not found +### opam remove good-md5-good-sha256 +The following actions will be performed: +=== remove 1 package + - remove good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-md5-good-sha256.1 +Done. +### opam install good-md5-good-sha256 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-md5-good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5-good-sha256.1 (cached) +-> installed good-md5-good-sha256.1 +Done. +### opam source good-md5-good-sha256 +Successfully extracted to ${BASEDIR}/good-md5-good-sha256.1 +### test -f good-md5-good-sha256.1/hello +### opam clean --download-cache +Clearing cache of downloaded files +### :I:4: good sha256 & good md5 +### opam lint --package good-sha256-good-md5 +/good-sha256-good-md5.1: Passed. +### opam lint --package good-sha256-good-md5 --check-upstream +/good-sha256-good-md5.1: Passed. +### opam clean --download-cache +Clearing cache of downloaded files +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-md5.1 +-> installed good-md5.1 +Done. ### opam install good-sha256-good-md5 The following actions will be performed: === install 1 package - install good-sha256-good-md5 1 +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> installed good-sha256-good-md5.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: not found +### opam remove good-sha256-good-md5 +The following actions will be performed: +=== remove 1 package + - remove good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed good-sha256-good-md5.1 +Done. +### opam install good-sha256-good-md5 --require-checksums +The following actions will be performed: +=== install 1 package + - install good-sha256-good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256-good-md5.1 (cached) +-> installed good-sha256-good-md5.1 +Done. +### opam source good-sha256-good-md5 +Successfully extracted to ${BASEDIR}/good-sha256-good-md5.1 +### test -f good-sha256-good-md5.1/hello +### opam clean --download-cache +Clearing cache of downloaded files +### :I:5: no checksum +### opam lint --package no-checksum +/no-checksum.1: Passed. +### opam lint --package no-checksum --check-upstream +/no-checksum.1: Warnings. + warning 59: url doesn't contain a checksum +### opam install no-checksum +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved no-checksum.1 (file://${BASEDIR}/archive.tgz) +-> installed no-checksum.1 +Done. +### opam remove no-checksum +The following actions will be performed: +=== remove 1 package + - remove no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed no-checksum.1 +Done. +### opam install no-checksum --require-checksums +The following actions will be performed: +=== install 1 package + - install no-checksum 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Failed to get sources of no-checksum.1: missing checksum + +OpamSolution.Fetch_fail("no-checksum.1: Missing checksum, and `--require-checksums` was set.") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch no-checksum 1 ++- +- No changes have been performed +# Return code 40 # +### opam source no-checksum +Successfully extracted to ${BASEDIR}/no-checksum.1 +### test -f no-checksum.1/hello +### opam clean --download-cache +Clearing cache of downloaded files +### :I:6: multiple md5 +### opam lint --package multiple-md5 +/multiple-md5.1: Passed. +### opam lint --package multiple-md5 --check-upstream | '[0-9a-z]{32}' -> 'hash' +/multiple-md5.1: Errors. + error 60: Upstream check failed: "The archive doesn't match checksum: + - archive: md5=hash, in opam file: md5=hash + ." +# Return code 1 # +### opam install multiple-md5 | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install multiple-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] multiple-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of multiple-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch multiple-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install multiple-md5 --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install multiple-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] multiple-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of multiple-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch multiple-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source multiple-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] multiple-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f multiple-md5.1/hello +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:7: bad md5 +### opam lint --package bad-md5 +/bad-md5.1: Passed. +### opam lint --package bad-md5 --check-upstream | '[0-9a-z]{32}' -> 'hash' +/bad-md5.1: Errors. + error 60: Upstream check failed: "The archive doesn't match checksum: + - archive: md5=hash, in opam file: md5=hash + ." +# Return code 1 # +### opam install bad-md5 | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install bad-md5 --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source bad-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f bad-md5.1/hello +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:8: good md5 & bad sha256 +### opam lint --package good-md5-bad-sha256 +/good-md5-bad-sha256.1: Passed. +### opam lint --package good-md5-bad-sha256 --check-upstream | '[0-9a-z]{64}' -> 'hash' +/good-md5-bad-sha256.1: Errors. + error 60: Upstream check failed: "The archive doesn't match checksum: + - archive: sha256=hash, in opam file: sha256=hash + ." +# Return code 1 # +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: not found +### opam install good-md5-bad-sha256 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (match) + - sha256=hash (MISMATCH) + +[ERROR] good-md5-bad-sha256.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get sources of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: not found +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### opam reinstall good-sha256 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/archive.tgz) +-> removed good-sha256.1 +-> installed good-sha256.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: archive, with matching checksum +### opam install good-md5-bad-sha256 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (match) + - sha256=hash (MISMATCH) + +[ERROR] good-md5-bad-sha256.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get sources of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: archive, with matching checksum +### opam install good-md5-bad-sha256 --require-checksums | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-md5-bad-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-md5-bad-sha256.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected sha256=hash + got sha256=hash +[ERROR] Failed to get sources of good-md5-bad-sha256.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-md5-bad-sha256 1 ++- +- No changes have been performed +# Return code 40 # +### opam source good-md5-bad-sha256 | '[0-9a-z]{64}' -> 'md5' +[ERROR] good-md5-bad-sha256.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected sha256=md5 + got sha256=md5 +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f good-md5-bad-sha256.1/hello +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:9: good sha256 & bad md5 +### opam lint --package good-sha256-bad-md5 +/good-sha256-bad-md5.1: Passed. +### opam lint --package good-sha256-bad-md5 --check-upstream | '[0-9a-z]{32}' -> 'hash' +/good-sha256-bad-md5.1: Errors. + error 60: Upstream check failed: "The archive doesn't match checksum: + - archive: md5=hash, in opam file: md5=hash + ." +# Return code 1 # +### opam install good-sha256-bad-md5 | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-sha256-bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of good-sha256-bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-sha256-bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam install good-sha256-bad-md5 --require-checksums | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install good-sha256-bad-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] good-sha256-bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of good-sha256-bad-md5.1: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch good-sha256-bad-md5 1 ++- +- No changes have been performed +# Return code 40 # +### opam source good-sha256-bad-md5 | '[0-9a-z]{32}' -> 'hash' +[ERROR] good-sha256-bad-md5.1: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f good-sha256-bad-md5.1/hello +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### :I:10: clash with all md5 +### opam lint --package clash-with-all-md5s +/clash-with-all-md5s.666: Passed. +### opam lint --package clash-with-all-md5s --check-upstream | '[0-9a-z]{32,64}' -> 'hash' +/clash-with-all-md5s.666: Errors. + error 60: Upstream check failed: "The archive doesn't match checksums: + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: md5=hash, in opam file: md5=hash + - archive: sha256=hash, in opam file: sha256=hash + ." +# Return code 1 # +### opam install clash-with-all-md5s | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] clash-with-all-md5s.666: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: not found +### opam reinstall good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-md5 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-md5.1 +-> installed good-md5.1 +Done. +### opam reinstall good-sha256 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256 1 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved good-sha256.1 (file://${BASEDIR}/archive.tgz) +-> removed good-sha256.1 +-> installed good-sha256.1 +Done. +### sh check-cache.sh +MD5: archive, with matching checksum +SHA256: archive, with matching checksum +### opam install clash-with-all-md5s | '[0-9a-z]{32,64}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Conflicting file hashes, or broken or compromised cache! + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (match) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - md5=hash (MISMATCH) + - sha256=hash (MISMATCH) + +[ERROR] clash-with-all-md5s.666: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### sh check-cache.sh +MD5: not found +SHA256: archive, with matching checksum +### opam install clash-with-all-md5s --require-checksums | '[0-9a-z]{32}' -> 'hash' +The following actions will be performed: +=== install 1 package + - install clash-with-all-md5s 666 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] clash-with-all-md5s.666: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Failed to get sources of clash-with-all-md5s.666: Checksum mismatch + +OpamSolution.Fetch_fail("Checksum mismatch") + + +<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> ++- The following actions failed +| - fetch clash-with-all-md5s 666 ++- +- No changes have been performed +# Return code 40 # +### opam source clash-with-all-md5s | '[0-9a-z]{32}' -> 'hash' +[ERROR] clash-with-all-md5s.666: Checksum mismatch for file://${BASEDIR}/archive.tgz: + expected md5=hash + got md5=hash +[ERROR] Download failed: Checksum mismatch +# Return code 40 # +### test -f clash-with-all-md5s.666/hello +# Return code 1 # +### opam clean --download-cache +Clearing cache of downloaded files +### ::::::::::::::::: +### :II: Cache manipulation +### ::::::::::::::::: +### :II:1: install with removed md5 frome cache, and kept sha256 +### opam reinstall good-sha256-good-md5 +The following actions will be performed: +=== recompile 1 package + - recompile good-sha256-good-md5 1 + <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/archive.tgz) +-> removed good-sha256-good-md5.1 -> installed good-sha256-good-md5.1 Done. ### sh check-cache.sh @@ -297,15 +1114,6 @@ The following actions will be performed: -> removed good-sha256-good-md5.1 -> installed good-sha256-good-md5.1 Done. -### opam install good-sha256.1 -The following actions will be performed: -=== install 1 package - - install good-sha256 1 - -<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> --> retrieved good-sha256.1 (cached) --> installed good-sha256.1 -Done. ### sh check-cache.sh MD5: link, to sha256 archive SHA256: archive, with matching checksum