Repository navigation
Commit ea7665e
fix(launcher): regenerate nqc launcher with the XDG pid/log ladder (#107)
## What changed and why
`nqc`'s launcher kept its pid and log in `/tmp` under a predictable
name. Another local user could pre-create or symlink the pid file and so
choose which PID `--stop` kills (CWE-377 class).
The `/tmp` paths came from explicit `pid-file` / `log-file` overrides in
`nqc/nqc.launcher.a2ml`. On its own, `realign` reproduces them verbatim,
as a probe run confirmed, and the current template then refuses them at
runtime as a shared location. This PR therefore:
1. **deletes those two override lines from `nqc/nqc.launcher.a2ml`**,
which is necessary for the generator to emit its default; and
2. **regenerates the launcher with `launch-scaffolder realign`**, built
from launch-scaffolder `origin/main` @ `2cb0f24` (`cargo build
--release`) and run with `--standard
standards/launcher-standard_praxis.deed`.
The resulting paths:
```
PID_FILE="${XDG_RUNTIME_DIR:-${XDG_STATE_HOME:-$HOME/.local/state}}/launch-scaffolder/nqc/server.pid"
LOG_FILE="${XDG_STATE_HOME:-$HOME/.local/state}/launch-scaffolder/nqc/server.log"
```
## Scope of the regenerated diff (the generator's canonical output, not
hand edits)
The launcher diff is large because it catches up with the current
template, not only the pid/log lines:
- the metadata block moves from `@a2ml-metadata` to `@launcher-deed`
(standard-version `0.4.0`, plus declared modes, platforms and lifecycle
phases);
- the new `ensure_state_dirs` creates the state dirs `0700`, and
`check_private_state_dir` refuses any state dir that isn't owned by the
user or is group/world-writable;
- `read_pid` validates the pid before any `kill`, and `stop` refuses an
unsafe pid dir;
- `--integ`/`--disinteg` gain atomic writes, desktop-entry escaping and
ownership markers, and the `.desktop` `Exec` now goes through
`keepopen.sh` with `Terminal=true`;
- values are single-quoted, and the output is shellcheck-clean.
`CONFIG_FILE` still points at the canonical `/var/mnt/eclipse/repos/...`
path. realign ran in a private mount namespace (`unshare -rm`) with this
worktree bind-mounted at the config's `[repo].path`, so no scratch path
was baked in.
**Also changed:** `nqc/Justfile`'s `clean` recipe removed `/tmp/nqc.pid
/tmp/nqc.log`. It now removes the same two files at their new locations
(`just --dry-run clean` checked).
**Unrelated, not changed:** `nqc.launcher.a2ml` still declares `license
= "PMPL-1.0-or-later"`. The generated launcher does not carry that
field, and the template emits the SPDX line twice (lines 2–3). Both are
left as they are.
## Verification
- `bash -n`: OK.
- `shellcheck` 0.11.0: findings went from 3 to 0.
- `grep -nE "[\"'/]tmp/"` on the launcher: 0 hits (was 2).
- `git diff --summary`: no mode change (stays `100755`).
- **Smoke run** on a copy with `START_COMMAND=('sleep' '300')`, using
the fallback rung (`XDG_RUNTIME_DIR` and `XDG_STATE_HOME` unset, scratch
`HOME`): `--start` wrote
`$HOME/.local/state/launch-scaffolder/nqc/server.pid` (directory
`0700`), and `--stop` killed exactly that PID and removed the pid file.
## Inherited red checks
The one failing check is not caused by this change:
- `Hypatia Security Scan / Hypatia Neurosymbolic Analysis` fails with
`Hypatia did not produce one valid findings array` (exit 2). That is a
crash of the tool, not a finding, and it fails identically on `main`
fc12a2e. Tracking issue, with acceptance criteria: #108.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_0136eszqrQ53Kj7aBH1D4rXK
---------
Signed-off-by: Jonathan D.A. Jewell <6759885+hyperpolymath@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>1 parent 6f3b454 commit ea7665e
3 files changed
Lines changed: 309 additions & 68 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
0 commit comments