mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-11-11 14:07:33 +01:00
lock_enforcement_files() runs at the end of every enforce-loop iteration and called _try_set_immutable() on both config files unconditionally, so the daemon forked `chattr +i` twice per iteration whether or not the flag was already set. Measured with bpftrace: 20 chattr execs per 30 seconds, ~56,000 per day, all of them re-applying a flag that was already there. Read the flag first with FS_IOC_GETFLAGS, which is an ioctl and costs no process, and only spawn chattr when the current state differs. _immutable_flag_is() fails closed on purpose: an unsupported filesystem, a refused ioctl, or an unreadable file all report False so the caller still runs chattr. A wrong True would silently stop enforcing immutability, which is much worse than a redundant fork. Verified live, not just in tests: `chattr` execs over 30s went 20 -> 0 after restarting the service, and clearing the flag by hand (`sudo chattr -i ~/.config/steam_backlog_enforcer/config.json`) still got it re-applied within ~10 seconds, so enforcement is unchanged. Full suite: 1091 passed, coverage 100.00%. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| docs | ||
| tests | ||
| __init__.py | ||
| _actions.py | ||
| _allowed_games.py | ||
| _cmd_done.py | ||
| _enforce_loop.py | ||
| _hltb_detail.py | ||
| _hltb_search.py | ||
| _hltb_types.py | ||
| _mcp.py | ||
| _scanning_confidence.py | ||
| _stats.py | ||
| _steam_state.py | ||
| _total_block.py | ||
| _web_dataset.py | ||
| _web_server.py | ||
| _whitelist.py | ||
| config.py | ||
| enforcer.py | ||
| game_install.py | ||
| hltb.py | ||
| library_hider.py | ||
| main.py | ||
| protondb.py | ||
| scanning.py | ||
| steam_api.py | ||
| store_blocker.py | ||