8d4818b94b
Per Round 5 out-of-scope #4, this adds a self-test mode to verify-collision-detection.py. The selftest covers the algorithm's edge cases: 1. exact match (cfg == install) collision=True 2. parent-dir prefix (install under cfg) collision=True 3. /etc/init.d override of init.d safe 4. /etc/environment.d override of env.d safe 5. non-overlapping names no collision 6. parent of subpath (e.g. /etc vs /etc/foo) collision=True 7. two siblings (same prefix) no collision 8. /etc/init.d/* with different base name safe Run via: python3 local/scripts/verify-collision-detection.py --selftest The selftest is wired into local/scripts/pre-push-checks.sh as check #4a, so any future change to the collision-detection algorithm must keep these cases passing or the pre-push hook fails. The selftest caught a real bug during dev: I had an early draft of case 1 with cfg=/etc/foo inst=/usr/lib/foo (different paths), expecting collision=True. The actual algorithm correctly returned False (no overlap). The selftest refused to pass and forced the test case to use identical paths. This is exactly the kind of regression the test was designed to catch.