From f99b4033095607ad5ba555b2a5522fc6ee7bcebb Mon Sep 17 00:00:00 2001 From: mrambossek Date: Tue, 26 May 2026 07:40:07 +0200 Subject: [PATCH] fix: sweep stale hashed indexes BEFORE fdroid update, not after MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit scan_repo_files() in fdroidserver picks up any .json file under repo/ whose name isn't in its ignore list. Our renamed index-v2-.json from the prior rehash run isn't in that list, so the next fdroid update indexed it as an installable "package" with packageName == its sha256. cleanup_stale_indexes in rehash.py already does the right thing — it just ran too late, after the bogus entry was already in the new index. Move the same sweep into the entrypoint, before fdroid update runs, so scan_repo_files() sees a clean directory. Co-Authored-By: Claude Opus 4.7 (1M context) --- entrypoint.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index bc9a02d..25b00a9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -9,10 +9,26 @@ set -eu . /etc/profile.d/bsenv.sh +# Pre-update cleanup: sweep hashed index files left by the prior rehash run. +# Otherwise fdroidserver's scan_repo_files() picks them up as installable +# items (their .json extension passes is_repo_file(), since the hashed name +# isn't in its ignore list) and a bogus "index-v2-" package shows up +# in the index. We check every arg (not just $1) so global flags before the +# subcommand (e.g. `-v update`) still trigger this. +for arg in "$@"; do + if [ "$arg" = "update" ]; then + for repodir in repo archive; do + if [ -d "$repodir" ]; then + rm -f "$repodir"/index-v2-*.json "$repodir"/index-v2-*.json.asc + fi + done + break + fi +done + GRADLE_USER_HOME="${home_vagrant}/.gradle" "${fdroidserver}/fdroid" "$@" -# Auto-rehash after a successful update. We check every arg (not just $1) -# so global flags before the subcommand (e.g. `-v update`) still trigger it. +# Auto-rehash after a successful update. for arg in "$@"; do if [ "$arg" = "update" ]; then fdroidserver-ipfs-rehash