Cleanup: a Firefox profile in use is detected again with other users' processes running

ff_in_use piped find into grep -q; with pipefail, find's error on any
unreadable /proc/<pid>/fd (root's processes) made every profile look
unused, so cleanup could remove user.js and rewrite prefs.js under a
running Firefox. The Nix check's sandbox has no such processes.
This commit is contained in:
Pierre Kisters committed 2026-10-01 04:10:04 +02:00
1 parent c810df7f5a
commit daf7c70ed3
1 file changed
+3 -1
+3 -1
View File
@@ -713,7 +713,9 @@ clean_icons() {
# --- Firefox user.js ---
ff_keys() { sed -n 's/^[[:space:]]*user_pref(\("[^"]*"\),.*/\1/p' "$1" 2>/dev/null || true; }
ff_in_use() { find /proc/[0-9]*/fd -lname "$1/.parentlock" -print -quit 2>/dev/null | grep -q .; }
# Not `find | grep -q`: find fails on other users' /proc/<pid>/fd, and with
# pipefail that would make every profile look unused.
ff_in_use() { [[ -n $(find /proc/[0-9]*/fd -lname "$1/.parentlock" -print -quit 2>/dev/null) ]]; }
clean_firefox() { # all
local all=$1 prof name u t kind keys pats left