#1154446 ca-certificates: drop stale CRTs on rebuild

#1154446#5
Date:
2026-11-19 09:48:21 UTC
From:
To:
Hello,

Rebuilding the Mozilla certificate set in an existing ca-certificates
source tree can retain certificates removed from the input set.
certdata2pem.py leaves old CRTs in place and writes a _2 variant when
the normal filename already exists.

To reproduce in a disposable extraction of the 20260816+nmu1 source:

  make -C mozilla all
  printf '\n"ISRG Root X1"\n' >> mozilla/blacklist.txt
  make -C mozilla all

The test-only blacklist edit simulates removing one root. Expected: 119
CRT files, with ISRG_Root_X1.crt gone. Observed: 238 CRTs (up from 120),
with ISRG_Root_X1.crt still present. With the attached patch, the repeated
build produced exactly the same 119 filenames and SHA-256 hashes as a
clean build with the changed blacklist. Tested the Debian source with
Python 3.14.4 and cryptography 46.0.5; no system trust store was modified.

The patch only clears generated outputs in mozilla/ before invoking the
converter. It does not change the source trust policy or installation.
The OpenWrt PR also addresses its separate private staging directory;
that downstream change is not part of this patch:
https://github.com/openwrt/openwrt/pull/26790

Bug discovery was LLM-assisted. A human reviewed the patch and
authorized its submission.

Thanks,
Alexey