From 9c154a29b9b1835815730031b607e28915f3620e Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Sun, 18 Oct 2026 19:43:40 +0200 Subject: [PATCH] fix: join system names with a separator they lack --- scripts/generate_pack.py | 7 +++++-- tests/test_audit_regressions.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/generate_pack.py b/scripts/generate_pack.py index 8520d5e0..97b77916 100644 --- a/scripts/generate_pack.py +++ b/scripts/generate_pack.py @@ -258,9 +258,12 @@ def _bounded_join(parts: list[str], keys: list[str]) -> str: """Parts joined while they fit, else the first, a count and a digest. Thirty systems joined made a 261-byte file name and the ZIP could not - be opened; the digest keeps two different selections apart. + be opened; the digest keeps two different selections apart. The joiner + is one no part holds: with "_", sega-dreamcast + arcade and + sega-dreamcast-arcade both named Dreamcast_Arcade, and the second build + replaced the first. """ - joined = "_".join(parts) + joined = "+".join(parts) if len(joined.encode("utf-8")) <= MAX_SYSTEM_TAG_BYTES: return joined digest = hashlib.sha1("\n".join(sorted(keys)).encode("utf-8")).hexdigest()[:8] diff --git a/tests/test_audit_regressions.py b/tests/test_audit_regressions.py index 371d79f1..fb24da41 100644 --- a/tests/test_audit_regressions.py +++ b/tests/test_audit_regressions.py @@ -2637,6 +2637,20 @@ class APackNameFitsAFileName(unittest.TestCase): self.assertNotEqual(tag, _system_tag(systems[:-1] + ["other-console"])) self.assertEqual(_system_tag(["sony-playstation"]), "_Playstation") + def test_two_systems_never_name_one_system(self): + """sega-dreamcast,arcade and sega-dreamcast-arcade both wrote + RetroArch_..._Dreamcast_Arcade.zip; the second replaced the first.""" + from scripts.generate_pack import _system_tag + + pairs = [ + (["sega-dreamcast", "arcade"], ["sega-dreamcast-arcade"]), + (["mega-cd", "sega-32x"], ["mega-cd-32x"]), + (["x86", "nintendo-64"], ["x86-64"]), + ] + for two, one in pairs: + with self.subTest(two=two): + self.assertNotEqual(_system_tag(two), _system_tag(one)) + def test_two_hash_lists_get_two_names(self): """--from-md5 named its pack after the context only: a second list overwrote the first pack in the same directory."""