Skip to content

[BUG] deadreckon doctor fails under a non-C locale with "checkpoint pid … has a different process-start identity" #3

Description

@maxalbert
  • Deadreckon Version: 0.8.4 (from source)
  • OS: macOS 15.7.7, launchd supervisor agent

Symptom

deadreckon doctor --repair is blocked:

supervisor service: failed - ... checkpoint pid 3874 has a different process-start identity

The supervisor is running normally; only the checkpoint validation reports a problem.

Root cause

process_start_identity() (crates/deadreckon-core/src/exec/pid_file.rs) builds the macOS start identity from /bin/ps -p <pid> -o lstart=, which is locale-dependent.

  • The instance.json checkpoint is written by the launchd-spawned supervisor, which runs under C locale (no LANG/LC_ALL).
  • doctor run from a user shell recomputes the identity under the shell locale (e.g. LANG=en_GB.UTF-8).

Same running process, different rendering — the byte-for-byte comparison in validate_checkpoint_identity() fails:

Locale ps -p 3874 -o lstart=
C / unset (supervisor) Fri Aug 7 06:47:56 2026
en_GB.UTF-8 (doctor) Fri 7 Aug 06:47:56 2026

The function is documented as a "stable same-boot identity", but the macOS implementation is locale-dependent, violating that guarantee. doctor --repair cannot self-heal because the repair loop re-evaluates the same comparison.

Reproduction

# fails
LANG=en_GB.UTF-8 deadreckon supervisor status --json
# passes
LANG=C deadreckon supervisor status --json
LANG=C deadreckon doctor --repair

Suggested fix

Pin the ps subprocess to the C locale in process_start_identity(), e.g. .env("LANG","C").env("LC_ALL","C"), or read a locale-independent start token (e.g. proc_pidinfo/kern.proc), matching the Linux branch's /proc/<pid>/stat field 22.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions