From 7285cc35b985dd0c7ddf8db32570b942f91bb263 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:05:00 +0100 Subject: [PATCH 01/10] fix(search): preserve curated Debian package identity --- debup-pkg/usr/local/bin/debup | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/debup-pkg/usr/local/bin/debup b/debup-pkg/usr/local/bin/debup index 3d6f6bf..776db53 100644 --- a/debup-pkg/usr/local/bin/debup +++ b/debup-pkg/usr/local/bin/debup @@ -963,6 +963,7 @@ debup_search() { local -a global_types=() local -a global_release_ids=() local -a global_assets=() + local -a global_expected_packages=() local display_idx=1 local apt_results="" local apt_search_failed=false @@ -987,6 +988,7 @@ debup_search() { global_types[display_idx]="APT" global_release_ids[display_idx]="" global_assets[display_idx]="" + global_expected_packages[display_idx]="" printf "${YELLOW}[%d]${NC} ${BOLD}%-35s${NC} ${GRAY}(APT)${NC}\n ${GRAY}%s${NC}\n" \ "$display_idx" "$apt_pkg" "${apt_desc:0:70}" @@ -1004,6 +1006,7 @@ debup_search() { local -a candidate_repos=() local -a candidate_stars=() local -a candidate_descs=() + local -a candidate_expected_packages=() local -A seen_repos=() local catalog_file="${SCRIPT_DIR}/../share/debup/curated_db.txt" local catalog_entries="" @@ -1012,8 +1015,8 @@ debup_search() { catalog_entries=$(catalog_search_repositories "$catalog_file" "$query") || catalog_entries="" fi - local catalog_repo catalog_package repo_key - while IFS='|' read -r catalog_repo catalog_package; do + local catalog_repo catalog_package catalog_expected_package repo_key + while IFS='|' read -r catalog_repo catalog_package catalog_expected_package; do [ -n "$catalog_repo" ] || continue repo_key="${catalog_repo,,}" [ -n "${seen_repos[$repo_key]+present}" ] && continue @@ -1021,6 +1024,7 @@ debup_search() { candidate_repos+=("$catalog_repo") candidate_stars+=("-") candidate_descs+=("Curated package: $catalog_package") + candidate_expected_packages+=("$catalog_expected_package") done <<< "$catalog_entries" local raw_results="" @@ -1051,6 +1055,7 @@ debup_search() { candidate_repos+=("$repo_name") candidate_stars+=("$stars") candidate_descs+=("$description") + candidate_expected_packages+=("") done else github_search_failed=true @@ -1074,11 +1079,12 @@ debup_search() { local gh_valid=0 local release_check_failed=0 local candidate_index=0 - local candidate_repo candidate_stars_value candidate_desc check_release deb_assets compatible_debs chosen_asset release_id release_tag + local candidate_repo candidate_stars_value candidate_desc candidate_expected_package check_release deb_assets compatible_debs chosen_asset release_id release_tag for candidate_repo in "${candidate_repos[@]}"; do candidate_stars_value="${candidate_stars[$candidate_index]}" candidate_desc="${candidate_descs[$candidate_index]}" + candidate_expected_package="${candidate_expected_packages[$candidate_index]}" candidate_index=$((candidate_index + 1)) if ! check_release=$(fetch_github_api "repos/${candidate_repo}/releases/latest" 10); then @@ -1110,6 +1116,7 @@ debup_search() { global_types[display_idx]="GH" global_release_ids[display_idx]="$release_id" global_assets[display_idx]="$chosen_asset" + global_expected_packages[display_idx]="$candidate_expected_package" if [ "$candidate_stars_value" = "-" ]; then printf " ${YELLOW}[%d]${NC} ${BOLD}%-35s${NC} ${CYAN}(curated)${NC}\n ${GRAY}%s${NC}\n" \ @@ -1175,10 +1182,11 @@ debup_search() { local selected_repo="$selected_target" local selected_release_id="${global_release_ids[choice]}" local selected_asset="${global_assets[choice]}" + local selected_expected_package="${global_expected_packages[choice]}" printf "${CYAN}%b${NC} ${GREEN}%s${NC}...\n" "$(printf "$MSG_INSPECTING_ASSETS" "")" "$selected_repo" printf "${CYAN}Selected release ID: %s; asset: %s${NC}\n" "$selected_release_id" "$selected_asset" - check_and_update "$selected_repo" "" false "$selected_release_id" "$selected_asset" + check_and_update "$selected_repo" "$selected_expected_package" false "$selected_release_id" "$selected_asset" local selected_install_status=$? if [ "$selected_install_status" -eq 1 ]; then install_failed=1 From 984e7af62ca8d79cebbfea06e42e457d5d699d49 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:05:06 +0100 Subject: [PATCH 02/10] chore: keep debup and dbp entry points identical --- debup-pkg/usr/local/bin/dbp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/debup-pkg/usr/local/bin/dbp b/debup-pkg/usr/local/bin/dbp index 3d6f6bf..776db53 100644 --- a/debup-pkg/usr/local/bin/dbp +++ b/debup-pkg/usr/local/bin/dbp @@ -963,6 +963,7 @@ debup_search() { local -a global_types=() local -a global_release_ids=() local -a global_assets=() + local -a global_expected_packages=() local display_idx=1 local apt_results="" local apt_search_failed=false @@ -987,6 +988,7 @@ debup_search() { global_types[display_idx]="APT" global_release_ids[display_idx]="" global_assets[display_idx]="" + global_expected_packages[display_idx]="" printf "${YELLOW}[%d]${NC} ${BOLD}%-35s${NC} ${GRAY}(APT)${NC}\n ${GRAY}%s${NC}\n" \ "$display_idx" "$apt_pkg" "${apt_desc:0:70}" @@ -1004,6 +1006,7 @@ debup_search() { local -a candidate_repos=() local -a candidate_stars=() local -a candidate_descs=() + local -a candidate_expected_packages=() local -A seen_repos=() local catalog_file="${SCRIPT_DIR}/../share/debup/curated_db.txt" local catalog_entries="" @@ -1012,8 +1015,8 @@ debup_search() { catalog_entries=$(catalog_search_repositories "$catalog_file" "$query") || catalog_entries="" fi - local catalog_repo catalog_package repo_key - while IFS='|' read -r catalog_repo catalog_package; do + local catalog_repo catalog_package catalog_expected_package repo_key + while IFS='|' read -r catalog_repo catalog_package catalog_expected_package; do [ -n "$catalog_repo" ] || continue repo_key="${catalog_repo,,}" [ -n "${seen_repos[$repo_key]+present}" ] && continue @@ -1021,6 +1024,7 @@ debup_search() { candidate_repos+=("$catalog_repo") candidate_stars+=("-") candidate_descs+=("Curated package: $catalog_package") + candidate_expected_packages+=("$catalog_expected_package") done <<< "$catalog_entries" local raw_results="" @@ -1051,6 +1055,7 @@ debup_search() { candidate_repos+=("$repo_name") candidate_stars+=("$stars") candidate_descs+=("$description") + candidate_expected_packages+=("") done else github_search_failed=true @@ -1074,11 +1079,12 @@ debup_search() { local gh_valid=0 local release_check_failed=0 local candidate_index=0 - local candidate_repo candidate_stars_value candidate_desc check_release deb_assets compatible_debs chosen_asset release_id release_tag + local candidate_repo candidate_stars_value candidate_desc candidate_expected_package check_release deb_assets compatible_debs chosen_asset release_id release_tag for candidate_repo in "${candidate_repos[@]}"; do candidate_stars_value="${candidate_stars[$candidate_index]}" candidate_desc="${candidate_descs[$candidate_index]}" + candidate_expected_package="${candidate_expected_packages[$candidate_index]}" candidate_index=$((candidate_index + 1)) if ! check_release=$(fetch_github_api "repos/${candidate_repo}/releases/latest" 10); then @@ -1110,6 +1116,7 @@ debup_search() { global_types[display_idx]="GH" global_release_ids[display_idx]="$release_id" global_assets[display_idx]="$chosen_asset" + global_expected_packages[display_idx]="$candidate_expected_package" if [ "$candidate_stars_value" = "-" ]; then printf " ${YELLOW}[%d]${NC} ${BOLD}%-35s${NC} ${CYAN}(curated)${NC}\n ${GRAY}%s${NC}\n" \ @@ -1175,10 +1182,11 @@ debup_search() { local selected_repo="$selected_target" local selected_release_id="${global_release_ids[choice]}" local selected_asset="${global_assets[choice]}" + local selected_expected_package="${global_expected_packages[choice]}" printf "${CYAN}%b${NC} ${GREEN}%s${NC}...\n" "$(printf "$MSG_INSPECTING_ASSETS" "")" "$selected_repo" printf "${CYAN}Selected release ID: %s; asset: %s${NC}\n" "$selected_release_id" "$selected_asset" - check_and_update "$selected_repo" "" false "$selected_release_id" "$selected_asset" + check_and_update "$selected_repo" "$selected_expected_package" false "$selected_release_id" "$selected_asset" local selected_install_status=$? if [ "$selected_install_status" -eq 1 ]; then install_failed=1 From 027b6500f1923f3c34b75725ed374da2084667d7 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:05:19 +0100 Subject: [PATCH 03/10] feat(search): support optional Debian package identity mapping --- debup-pkg/usr/local/share/debup/search.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/debup-pkg/usr/local/share/debup/search.sh b/debup-pkg/usr/local/share/debup/search.sh index c87b224..eb7e850 100644 --- a/debup-pkg/usr/local/share/debup/search.sh +++ b/debup-pkg/usr/local/share/debup/search.sh @@ -13,7 +13,7 @@ catalog_search_repositories() { BEGIN { query = tolower(query) } - NF != 3 || $2 != "github" { + (NF != 3 && NF != 4) || $2 != "github" { next } $1 !~ /^[a-z0-9][a-z0-9+.-]*$/ { @@ -22,12 +22,16 @@ catalog_search_repositories() { $3 !~ /^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/ { next } + NF == 4 && $4 !~ /^[a-z0-9][a-z0-9+.-]*$/ { + next + } { package_name = tolower($1) repository = tolower($3) if (index(package_name, query) || index(repository, query)) { if (!seen[repository]++) { - print $3 "|" $1 + expected_package = (NF == 4 ? $4 : "") + print $3 "|" $1 "|" expected_package count++ if (count >= 10) { exit From 4e55e4d33dfe909e35b29823fd830259fe6c1885 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:05:35 +0100 Subject: [PATCH 04/10] test(search): cover optional Debian package identity mapping --- tests/test_search.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/test_search.sh b/tests/test_search.sh index 3480c5d..0156a93 100644 --- a/tests/test_search.sh +++ b/tests/test_search.sh @@ -11,28 +11,42 @@ trap 'rm -rf -- "$TEST_DIR"' EXIT CATALOG="${TEST_DIR}/curated_db.txt" cat > "$CATALOG" <<'EOF' -alpha-app|github|Acme/Alpha +alpha-app|github|Acme/Alpha|alpha-deb shared-tool|github|Acme/Shared alpha-cli|github|Acme/Alpha direct-alpha|direct|https://example.org/alpha.deb malformed|github invalid-repo|github|not a valid repository uppercase-name|GITHUB|Acme/Uppercase +invalid-package-map|github|Acme/Invalid|INVALID_NAME +extra-field|github|Acme/Extra|valid-name|unexpected EOF actual="$(catalog_search_repositories "$CATALOG" "ALPHA")" -expected='Acme/Alpha|alpha-app' +expected='Acme/Alpha|alpha-app|alpha-deb' [[ "$actual" == "$expected" ]] || { printf 'FAIL: case-insensitive matching or repository deduplication failed\nExpected: %s\nActual: %s\n' "$expected" "$actual" >&2 exit 1 } actual="$(catalog_search_repositories "$CATALOG" "shared")" -[[ "$actual" == 'Acme/Shared|shared-tool' ]] || { +[[ "$actual" == 'Acme/Shared|shared-tool|' ]] || { printf 'FAIL: repository-name matching failed: %s\n' "$actual" >&2 exit 1 } +actual="$(catalog_search_repositories "$CATALOG" "shared-tool")" +[[ "$actual" == 'Acme/Shared|shared-tool|' ]] || { + printf 'FAIL: legacy three-field entries must keep an empty expected package identity: %s\\n' "$actual" >&2 + exit 1 +} + +actual="$(catalog_search_repositories "$CATALOG" "invalid-package-map")" +[[ -z "$actual" ]] || { + printf 'FAIL: invalid Debian package identity mapping was accepted: %s\\n' "$actual" >&2 + exit 1 +} + actual="$(catalog_search_repositories "$CATALOG" '[')" [[ -z "$actual" ]] || { printf 'FAIL: literal query matching treated punctuation as a pattern: %s\n' "$actual" >&2 From 98d0dad85af53a1e50f0a087c19ea90c9a9d75f1 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:06:55 +0100 Subject: [PATCH 05/10] fix(catalog): preserve explicit Debian package mappings on sync --- scripts/sync_catalog.sh | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/sync_catalog.sh b/scripts/sync_catalog.sh index 0cf0563..f04f6a5 100644 --- a/scripts/sync_catalog.sh +++ b/scripts/sync_catalog.sh @@ -41,6 +41,19 @@ readonly PACKAGE_DIR="${WORK_DIR}/deb-get/01-main/packages" printf '[*] Parsing package recipes...\n' +# Preserve explicit Debian Package: identity mappings across catalog refreshes. +declare -A expected_package_mappings=() +if [[ -r "$CATALOG_FILE" ]]; then + while IFS='|' read -r existing_package existing_provider existing_repo existing_expected extra || [[ -n "${existing_package:-}" ]]; do + [[ -z "${extra:-}" && + "$existing_provider" == "github" && + "$existing_package" =~ ^[a-z0-9][a-z0-9+.-]*$ && + "$existing_repo" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*$ && + "$existing_expected" =~ ^[a-z0-9][a-z0-9+.-]*$ ]] || continue + expected_package_mappings["$existing_package"]="${existing_repo}|${existing_expected}" + done < "$CATALOG_FILE" +fi + shopt -s nullglob recipe_files=("${PACKAGE_DIR}"/*) shopt -u nullglob @@ -65,7 +78,13 @@ for recipe in "${recipe_files[@]}"; do ' "$recipe")" if [[ -n "$github_repo" && "$github_repo" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]]; then - printf '%s|github|%s\n' "$package_name" "$github_repo" >> "$TMP_CATALOG" + mapped_identity="${expected_package_mappings[$package_name]:-}" + if [[ "$mapped_identity" == "${github_repo}|"* ]]; then + expected_deb_package="${mapped_identity#*|}" + printf '%s|github|%s|%s\n' "$package_name" "$github_repo" "$expected_deb_package" >> "$TMP_CATALOG" + else + printf '%s|github|%s\n' "$package_name" "$github_repo" >> "$TMP_CATALOG" + fi continue fi @@ -84,7 +103,7 @@ fi # Validate every generated record before replacing the tracked catalog. awk -F'|' ' - NF != 3 || $1 !~ /^[a-z0-9][a-z0-9+.-]*$/ || $2 != "github" || $3 !~ /^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/ { + (NF != 3 && NF != 4) || $1 !~ /^[a-z0-9][a-z0-9+.-]*$/ || $2 != "github" || $3 !~ /^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/ || (NF == 4 && $4 !~ /^[a-z0-9][a-z0-9+.-]*$/) { exit 1 } seen[$1] && seen[$1] != $3 { From 0085710724da337cedcdfed4f06eb5083b0757f0 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:07:05 +0100 Subject: [PATCH 06/10] test(catalog): preserve Debian identity mappings during sync --- tests/test_sync_catalog.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/tests/test_sync_catalog.sh b/tests/test_sync_catalog.sh index d1c507c..605ba6d 100644 --- a/tests/test_sync_catalog.sh +++ b/tests/test_sync_catalog.sh @@ -40,12 +40,27 @@ export PATH="${BIN_DIR}:${PATH}" CATALOG="${REPO_DIR}/curated_db.txt" # A failed upstream clone must leave the previous catalog untouched. -printf 'preserve|github|owner/repository\n' > "$CATALOG" +printf 'preserve|github|owner/repository\ngithub-app|github|vendor/github-app|github-app-deb\n' > "$CATALOG" if MOCK_GIT_FAIL=1 "${REPO_DIR}/scripts/sync_catalog.sh" >/dev/null 2>&1; then printf 'FAIL: expected clone failure\n' >&2 exit 1 fi -[[ "$(cat "$CATALOG")" == 'preserve|github|owner/repository' ]] || { +[[ "$(cat "$CATALOG")" == || { + printf 'FAIL: existing catalog was modified after clone failure\n' >&2 + exit 1 +} + +# Successful synchronization must include literal supported entries only. +MOCK_GIT_FAIL=0 "${REPO_DIR}/scripts/sync_catalog.sh" >/dev/null +expected='github-app|github|vendor/github-app|github-app-deb' +actual="$(cat "$CATALOG")" +[[ "$actual" == "$expected" ]] || { + printf 'FAIL: unexpected generated catalog\nExpected:\n%s\nActual:\n%s\n' "$expected" "$actual" >&2 + exit 1 +} + +printf 'PASS: catalog generation, filtering, sorting, and failure preservation\n' +preserve|github|owner/repository\ngithub-app|github|vendor/github-app|github-app-deb' ]] || { printf 'FAIL: existing catalog was modified after clone failure\n' >&2 exit 1 } From 635fb609322ad9e9a8cc9bf9f0caed1bd3c6238c Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:07:12 +0100 Subject: [PATCH 07/10] test(search): tidy identity mapping diagnostics --- tests/test_search.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_search.sh b/tests/test_search.sh index 0156a93..9d87013 100644 --- a/tests/test_search.sh +++ b/tests/test_search.sh @@ -37,7 +37,7 @@ actual="$(catalog_search_repositories "$CATALOG" "shared")" actual="$(catalog_search_repositories "$CATALOG" "shared-tool")" [[ "$actual" == 'Acme/Shared|shared-tool|' ]] || { - printf 'FAIL: legacy three-field entries must keep an empty expected package identity: %s\\n' "$actual" >&2 + printf 'FAIL: legacy three-field entries must keep an empty expected package identity: %s\n' "$actual" >&2 exit 1 } From eab5cc09c31a67d0008efad61a692fb1b3c1f077 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:07:37 +0100 Subject: [PATCH 08/10] test(catalog): verify Debian identity mapping survives sync --- tests/test_sync_catalog.sh | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/tests/test_sync_catalog.sh b/tests/test_sync_catalog.sh index 605ba6d..63c523e 100644 --- a/tests/test_sync_catalog.sh +++ b/tests/test_sync_catalog.sh @@ -45,12 +45,13 @@ if MOCK_GIT_FAIL=1 "${REPO_DIR}/scripts/sync_catalog.sh" >/dev/null 2>&1; then printf 'FAIL: expected clone failure\n' >&2 exit 1 fi -[[ "$(cat "$CATALOG")" == || { +expected_preserved=$'preserve|github|owner/repository\ngithub-app|github|vendor/github-app|github-app-deb' +[[ "$(cat "$CATALOG")" == "$expected_preserved" ]] || { printf 'FAIL: existing catalog was modified after clone failure\n' >&2 exit 1 } -# Successful synchronization must include literal supported entries only. +# Successful synchronization must include literal supported entries and preserve explicit mappings. MOCK_GIT_FAIL=0 "${REPO_DIR}/scripts/sync_catalog.sh" >/dev/null expected='github-app|github|vendor/github-app|github-app-deb' actual="$(cat "$CATALOG")" @@ -59,19 +60,4 @@ actual="$(cat "$CATALOG")" exit 1 } -printf 'PASS: catalog generation, filtering, sorting, and failure preservation\n' -preserve|github|owner/repository\ngithub-app|github|vendor/github-app|github-app-deb' ]] || { - printf 'FAIL: existing catalog was modified after clone failure\n' >&2 - exit 1 -} - -# Successful synchronization must include literal supported entries only. -MOCK_GIT_FAIL=0 "${REPO_DIR}/scripts/sync_catalog.sh" >/dev/null -expected='github-app|github|vendor/github-app' -actual="$(cat "$CATALOG")" -[[ "$actual" == "$expected" ]] || { - printf 'FAIL: unexpected generated catalog\nExpected:\n%s\nActual:\n%s\n' "$expected" "$actual" >&2 - exit 1 -} - -printf 'PASS: catalog generation, filtering, sorting, and failure preservation\n' +printf 'PASS: catalog generation, filtering, sorting, mapping preservation, and failure preservation\n' From 16c7fa8ef91746779e42ea0bf4eaf0e7a21ceee0 Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:07:42 +0100 Subject: [PATCH 09/10] test(search): normalize mapping test output --- tests/test_search.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_search.sh b/tests/test_search.sh index 9d87013..94cfcce 100644 --- a/tests/test_search.sh +++ b/tests/test_search.sh @@ -43,7 +43,7 @@ actual="$(catalog_search_repositories "$CATALOG" "shared-tool")" actual="$(catalog_search_repositories "$CATALOG" "invalid-package-map")" [[ -z "$actual" ]] || { - printf 'FAIL: invalid Debian package identity mapping was accepted: %s\\n' "$actual" >&2 + printf 'FAIL: invalid Debian package identity mapping was accepted: %s\n' "$actual" >&2 exit 1 } From e88e7271a806ced33889dc057a0dc80a15f4807e Mon Sep 17 00:00:00 2001 From: Ruraam <112347754+Ruraam@users.noreply.github.com> Date: Fri, 13 Nov 2026 06:08:07 +0100 Subject: [PATCH 10/10] fix(catalog): reject ambiguous package identity mappings --- scripts/sync_catalog.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/sync_catalog.sh b/scripts/sync_catalog.sh index f04f6a5..720bdad 100644 --- a/scripts/sync_catalog.sh +++ b/scripts/sync_catalog.sh @@ -62,6 +62,7 @@ shopt -u nullglob for recipe in "${recipe_files[@]}"; do [[ -f "$recipe" ]] || continue package_name="$(basename -- "$recipe")" + [[ "$package_name" =~ ^[a-z0-9][a-z0-9+.-]*$ ]] || continue # Only accept literal, quoted upstream values. Dynamic shell expressions # are intentionally ignored instead of being evaluated. @@ -106,11 +107,12 @@ awk -F'|' ' (NF != 3 && NF != 4) || $1 !~ /^[a-z0-9][a-z0-9+.-]*$/ || $2 != "github" || $3 !~ /^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/ || (NF == 4 && $4 !~ /^[a-z0-9][a-z0-9+.-]*$/) { exit 1 } - seen[$1] && seen[$1] != $3 { + identity = $3 "|" (NF == 4 ? $4 : "") + seen[$1] && seen[$1] != identity { exit 1 } { - seen[$1] = $3 + seen[$1] = identity } ' "$TMP_CATALOG" || die "Generated catalog failed validation or contains ambiguous package names."