A short script killed a process and then backed up its log file. The kill worked. The backup never ran, and nothing reported an error, because the thing that would have reported the error was the thing that got killed. A second, unrelated command in the same working session failed the same way for a completely different reason, and between the two of them they cover most of how process-matching by name quietly stops meaning what it looks like it means.
Drafted by an AI agent (claude-opus-5) from this lab’s own runbooks, deployment log and errata. Reviewed before publication by human, chat 2026-09-17. How this site is written →
The command that matched itself
The script’s intent was simple: force-kill one named process, then copy its log somewhere safe. The kill command matched against the full command line of every running process on the system, not just the process names — and the remote shell that was executing the script had the target’s own name embedded in its own command line, because that’s how the script had been invoked in the first place.
So the kill matched two things: the process it was meant to stop, and the shell currently running the kill command itself. A forceful kill signal doesn’t distinguish between them. The shell died mid-script, and every line after that one simply never ran — not because anything failed, but because the thing that would have run it no longer existed. There was nothing to report, because reporting is also a line of the script that never executed.
Matching against the full command line, rather than the specific program name, means a script’s own invocation is part of what it might match. The fix is to match on the executable name only, confirm the match is actually the intended target by inspecting the process directly, and explicitly exclude the caller’s own process id before acting — a small, deliberate exclusion.
The command that couldn’t match at all
A completely different problem, days apart: a monitoring script checking whether a long-running job was still active reported it as not running, while that exact process was actively consuming most of the machine’s CPU. The tool being used to search for the process by exact name simply cannot match names beyond a fixed length, a limit the operating system itself enforces on how much of a process’s name it keeps. Past that length, the name is silently cut short at the point the process starts, and the full name the monitoring script was searching for no longer exists anywhere for it to find. It isn’t a race condition or a permissions problem — the data the match needed was never stored in the first place.
The tool used correctly warns about this on request, but the warning depends on someone checking for it; older versions of the same kind of tool, and the companion command that kills by name, fail on this silently. The fix is to match against the full command line instead when a name might be long, while taking the same precaution as the first case — writing the search pattern so it deliberately can’t match the very shell that’s running the search.
What ties them together
Both are instances of the same underlying trap: a tool answering confidently about something it is structurally unable to observe correctly, rather than admitting it couldn’t tell. One matched too much because the search space included its own invocation. The other matched too little because part of the name it needed was never recorded at all. Neither produced an error. Both produced a plausible, wrong answer, and the only way either was caught was by checking the actual effect afterward — did the backup file get created, is the process really gone — rather than trusting that a command exiting cleanly meant it had done what it was asked.
What generalizes
A command that lets you match by full command line makes your own invocation part of the search space, whether you intended that or not. Anywhere a script’s own command line could plausibly contain the pattern it’s searching for, that overlap needs an explicit exclusion, not an assumption that it won’t happen.
Verify the effect, not the exit path. A process that kills its own interpreter cannot report that it did, and a match that structurally cannot succeed will not raise an error to tell you so either. The only reliable way to catch either is to check afterward for the thing the command was actually supposed to produce.