From c22f41a6d74c44ea967119c2e88dd2e07d072efe Mon Sep 17 00:00:00 2001 From: "Antoine R. Dumont (@ardumont)" Date: Thu, 6 Oct 2022 15:38:30 +0200 Subject: [PATCH] nixguix: Exclude faulty "recursive" file origins from listing For now, those can be faulty as the manifest is missing 'critical' information about how to recompute the hash (e.g. fs layout, executable bit, ...). Related to T4608 Related to T3781 --- swh/lister/nixguix/lister.py | 12 ++++++++++++ swh/lister/nixguix/tests/data/sources-failure.json | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/swh/lister/nixguix/lister.py b/swh/lister/nixguix/lister.py index 59976c3..1dbd4de 100644 --- a/swh/lister/nixguix/lister.py +++ b/swh/lister/nixguix/lister.py @@ -430,6 +430,18 @@ class NixGuixLister(StatelessLister[PageResult]): # the output can be anything, including a directory tree. outputHashMode = artifact.get("outputHashMode", "flat") + if not is_tar and outputHashMode == "recursive": + # T4608: Cannot deal with those properly yet as some can be missing + # 'critical' information about how to recompute the hash (e.g. fs + # layout, executable bit, ...) + logger.warning( + "Skipping artifact <%s>: 'file' artifact of type <%s> is " + " missing information to properly check its integrity", + artifact, + artifact_type, + ) + continue + logger.debug("%s: %s", "dir" if is_tar else "cnt", origin) yield ArtifactType.ARTIFACT, Artifact( origin=origin, diff --git a/swh/lister/nixguix/tests/data/sources-failure.json b/swh/lister/nixguix/tests/data/sources-failure.json index 096ea7e..e0844af 100644 --- a/swh/lister/nixguix/tests/data/sources-failure.json +++ b/swh/lister/nixguix/tests/data/sources-failure.json @@ -37,6 +37,17 @@ ], "inferredFetcher": "fetchzip" }, + { + "outputHash": "0s2mvy1nr2v1x0rr1fxlsv8ly1vyf9978rb4hwry5vnr678ls522", + "outputHashAlgo": "sha256", + "outputHashMode": "recursive", + "type": "url", + "urls": [ + "https://www.unicode.org/Public/emoji/12.1/emoji-zwj-sequences.txt" + ], + "integrity": "sha256-QhRN0THZ7uIzh2RldFJyfgdP0da0u5Az6GGLbIPfVWg=", + "inferredFetcher": "unclassified" + }, { "type": "url", "urls": [ "unknown://example.org/wrong-scheme-so-skipped.txt" ],