diff --git a/ci/release_artifact_lint.py b/ci/release_artifact_lint.py index ddd998e9..e5a9714a 100644 --- a/ci/release_artifact_lint.py +++ b/ci/release_artifact_lint.py @@ -20,6 +20,9 @@ # REL-009 owner rule (#296): debug symbols ship only as GitHub release # sidecars, never inside a wheel. SYMBOL_SUFFIXES = (".pdb", ".debug", ".dwp", ".dwo", "-symbols.tar.zst") +# rustc's gdb pretty-printer loader: not DWARF, and `strip --strip-debug` +# deliberately keeps it (forge-ci/ci.yml#574). +NON_DWARF_DEBUG_SECTIONS = frozenset({".debug_gdb_scripts"}) def _elf_debug_sections(data: bytes) -> list[str]: @@ -45,7 +48,10 @@ def header(index: int) -> bytes: for index in range(shnum): name_off = int.from_bytes(header(index)[0:4], "little") name = names[name_off:].split(b"\0", 1)[0].decode("latin-1") - if name.startswith((".debug_", ".zdebug_")): + if ( + name.startswith((".debug_", ".zdebug_")) + and name not in NON_DWARF_DEBUG_SECTIONS + ): found.append(name) return found diff --git a/tests/unit/test_ci_modes.py b/tests/unit/test_ci_modes.py index a2557ea9..ed9a8f8f 100644 --- a/tests/unit/test_ci_modes.py +++ b/tests/unit/test_ci_modes.py @@ -607,3 +607,21 @@ def log_message(self, format, *args): assert verify.download(f"http://127.0.0.1:{port}/zip") == b"zipbytes" finally: server.shutdown() + + +def test_release_artifact_lint_allows_debug_gdb_scripts_only(): + """`strip --strip-debug` keeps rustc's .debug_gdb_scripts (not DWARF), forge-ci/ci.yml#574.""" + kept = _elf64([".text", ".debug_gdb_scripts", ".gnu_debuglink"]) + assert artifacts.wheel_symbol_problems({"fastled/bin/fastled": kept}) == [] + for dwarf in ( + ".debug_info", + ".debug_line", + ".debug_abbrev", + ".debug_str", + ".debug_ranges", + ".zdebug_info", + ): + image = _elf64([".text", ".debug_gdb_scripts", dwarf]) + problems = artifacts.wheel_symbol_problems({"fastled/bin/fastled": image}) + assert problems and dwarf in problems[0], dwarf + assert ".debug_gdb_scripts" not in problems[0], dwarf