From 0622d17d0f455b6910df058b385ed2ab03c339a8 Mon Sep 17 00:00:00 2001 From: Raja Boujbel Date: Tue, 16 Jul 2024 17:58:05 +0200 Subject: [PATCH] fixup! cache: when fetching from cache, add missing symlink for every checksum found in opam file --- tests/reftests/archive.test | 18 +++++++++++------- tests/reftests/extrasource.test | 22 +++++++++------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/reftests/archive.test b/tests/reftests/archive.test index 69c2eaac0e3..3d9cdf235c7 100644 --- a/tests/reftests/archive.test +++ b/tests/reftests/archive.test @@ -354,7 +354,7 @@ The following actions will be performed: Done. ### sh check-cache.sh MD5: archive, with matching checksum -SHA256: not found +SHA256: link, to md5 archive ### opam remove good-md5-good-sha256 The following actions will be performed: === remove 1 package @@ -405,7 +405,7 @@ The following actions will be performed: Done. ### sh check-cache.sh MD5: archive, with matching checksum -SHA256: not found +SHA256: link, to md5 archive ### opam remove good-sha256-good-md5 The following actions will be performed: === remove 1 package @@ -962,7 +962,7 @@ The following actions will be performed: -> installed good-sha256-good-md5.1 Done. ### sh check-cache.sh -MD5: not found +MD5: link, to sha256 archive SHA256: archive, with matching checksum ### opam clean --download-cache Clearing cache of downloaded files @@ -1028,15 +1028,19 @@ The following actions will be performed: - install good-sha256-good-md5 1 <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> --> retrieved good-sha256-good-md5.1 (cached) +[ERROR] Conflicting file hashes, or broken or compromised cache! + - sha256=99a0bdda5cc48eef1f53c6831c06c4b1d51bc746e68a84efc71785f00d7e927e (MISMATCH) + - md5=2c729f293240d43f46058280c2ac00e3 (MISMATCH) + +-> retrieved good-sha256-good-md5.1 (file://${BASEDIR}/archive.tgz) -> installed good-sha256-good-md5.1 Done. ### sh check-cache.sh -MD5: archive, with mismatching checksum +MD5: link, to sha256 archive SHA256: archive, with matching checksum ### :II:4: corrupt sha256 archive in cache ### sh check-cache.sh -MD5: archive, with mismatching checksum +MD5: link, to sha256 archive SHA256: archive, with matching checksum ### opam remove good-sha256-good-md5 The following actions will be performed: @@ -1050,7 +1054,7 @@ Done. ### rm "$ARCHIVE_SHA256_PATH" ### tar czf "$ARCHIVE_SHA256_PATH" check-cache.sh ### sh check-cache.sh -MD5: archive, with matching checksum +MD5: link, to sha256 archive SHA256: archive, with mismatching checksum ### # what happens here is that sha256 is checked first, there is a mismatch on sha256 archive (checking its sha256 & md5), so it is remove, returns file not available, and then it downloads the archive from url ### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash' diff --git a/tests/reftests/extrasource.test b/tests/reftests/extrasource.test index f46207d1e0c..83d1b74aa42 100644 --- a/tests/reftests/extrasource.test +++ b/tests/reftests/extrasource.test @@ -429,7 +429,7 @@ The following actions will be performed: Done. ### sh check-cache.sh MD5: patch, with matching checksum -SHA256: not found +SHA256: link, to md5 patch ### opam remove good-md5-good-sha256 The following actions will be performed: === remove 1 package @@ -480,7 +480,7 @@ The following actions will be performed: Done. ### sh check-cache.sh MD5: patch, with matching checksum -SHA256: not found +SHA256: link, to md5 patch ### opam remove good-sha256-good-md5 The following actions will be performed: === remove 1 package @@ -1090,7 +1090,7 @@ The following actions will be performed: -> installed good-sha256-good-md5.1 Done. ### sh check-cache.sh -MD5: not found +MD5: link, to sha256 patch SHA256: patch, with matching checksum ### opam clean --download-cache Clearing cache of downloaded files @@ -1120,11 +1120,11 @@ The following actions will be performed: Done. ### sh check-cache.sh MD5: patch, with matching checksum -SHA256: not found +SHA256: link, to md5 patch ### :III:c: corrupt md5 patch in cache ### sh check-cache.sh MD5: patch, with matching checksum -SHA256: not found +SHA256: link, to md5 patch ### opam remove good-sha256-good-md5 The following actions will be performed: === remove 1 package @@ -1136,7 +1136,7 @@ Done. ### cp check-cache.sh "$PATCH_MD5_PATH" ### sh check-cache.sh MD5: patch, with mismatching checksum -SHA256: not found +SHA256: link, to md5 patch ### opam install good-sha256-good-md5 | '[0-9a-z]{32,64}' -> 'hash' The following actions will be performed: === install 1 package @@ -1177,16 +1177,12 @@ The following actions will be performed: - 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) +-> retrieved good-sha256-good-md5.1 (cached) -> installed good-sha256-good-md5.1 Done. ### sh check-cache.sh -MD5: link, to sha256 patch -SHA256: patch, with matching checksum +MD5: patch, with matching checksum +SHA256: patch, with mismatching checksum ### :III:5: Both corrupted ### opam remove good-sha256-good-md5 The following actions will be performed: