git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitd565a176bf12cb9ccc274989fe0b8d0363713148
parent08a3d94db9
authorLucas Galante <[email protected]>
date2026-08-14 01:49
fix: find stale processes by exe, not by a guess at their argv

`ccebuild status` prefiltered candidates with `pgrep -f 'cce-'` before reading
/proc/<pid>/exe, which made the report depend on a process's argv containing
that substring. A process's command line has no reliable bearing on which
binary it is.

The compositor is the case that matters. startcce launches it through the
`cce` symlink, so its argv is

    /home/lsgalante/.local/bin/cce --log-level debug -c /tmp/cce-launch.sh

which contains 'cce-' only by way of the launch script's name. Rename that
script, or drop the -c argument, and cce-fx disappears from a report whose
entire purpose is "is what's running actually the code I built?" — and it is
the one process that most needs to appear there, because `restart`
deliberately cannot restart the compositor, so it sits on a stale binary
longer than anything else. `ccectl` was unreachable for the same reason,
which is why the case arm listing it was already dead.

Now the loop walks /proc directly and filters on the exe basename, which is
what it always trusted anyway (`cce*` subsumes both ccectl and the bare `cce`
symlink). Verified: the report is unchanged for the live session, and a
process named ccetest with no 'cce-' anywhere in its argv — invisible to the
old prefilter — is now listed.

Co-Authored-By: Claude <[email protected]>

 scripts/ccebuild | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/scripts/ccebuild b/scripts/ccebuild
index 651055d..81d62c4 100755
--- a/scripts/ccebuild
+++ b/scripts/ccebuild
@@ -202,12 +202,25 @@ cmd_status() {
     printf -- '-- %d up to date, %d stale, %d missing\n' "$ok" "$stale" "$missing"
 
     printf '\n==> running processes not using the installed binary\n'
+    # Scan /proc directly rather than prefiltering with `pgrep -f cce-`: a
+    # process's ARGV has no reliable bearing on which binary it is. The
+    # compositor is the case that matters — startcce launches it through the
+    # `cce` symlink, so its argv is "…/bin/cce --log-level debug -c
+    # /tmp/cce-launch.sh" and it only ever matched 'cce-' by way of that
+    # incidental script path. Rename or drop that argument and the one process
+    # this report exists for would silently vanish from it, precisely because
+    # `restart` cannot restart the compositor and it therefore sits on a stale
+    # binary longer than anything else. (`ccectl` was unreachable for the same
+    # reason.) The exe basename below is the authoritative test; it needs no
+    # help from a guess about argv.
     local found=0 pid exe base
-    for pid in $(pgrep -f 'cce-' 2>/dev/null || true); do
+    for pid in /proc/[0-9]*; do
+        pid=${pid#/proc/}
         exe=$(readlink "/proc/$pid/exe" 2>/dev/null) || continue
         base=${exe%% (deleted)}
         base=$(basename "$base")
-        case "$base" in cce*|ccectl) ;; *) continue ;; esac
+        # `cce*` already covers ccectl and the bare `cce` symlink.
+        case "$base" in cce*) ;; *) continue ;; esac
         if [ "$exe" != "$BINDIR/$base" ]; then
             printf '  %-8s %-24s %s\n' "$pid" "$base" "$exe"
             found=1