[Bug 295893] "procstat binary <pid>" returns 0 despite file not found after replacing binary

From: <bugzilla-noreply_at_freebsd.org>
Date: Sat, 06 Jun 2026 13:15:38 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295893

            Bug ID: 295893
           Summary: "procstat binary <pid>" returns 0 despite file not
                    found after replacing binary
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: ltning-freebsd@anduin.net

When using 'procstat binary' to identify whether running code matches the
on-disk version, I get the following behaviour:

---
$ procstat binary $$
  PID COMM                OSREL PATH
38822 bash              1500068 /usr/local/bin/bash
$ sudo pkg upgrade -qy bash
$ procstat binary $$
  PID COMM                OSREL PATH
procstat: sysctl: kern.proc.pathname: 38822: No such file or directory
$ echo $?
0
---

I would expect the exit code to be 1, as it would be if the given PID did not
exist:

---
$ procstat binary 1234
procstat: sysctl(kern.proc): No such process
procstat: procstat_getprocs()
$ echo $?
1
---

Am I wrong in assuming this can be considered a bug?

-- 
You are receiving this mail because:
You are the assignee for the bug.