Skip to content

scripts/gen-sdui-manifest.sh cannot run twice on macOS — its mktemp templates put the X's before a suffix, which BSD mktemp takes literally #15182

Description

@hotlong

Measured

scripts/gen-sdui-manifest.sh creates its logs with

DUMP_DEV_LOG="$(mktemp "${TMPDIR:-/tmp}/sdui-dump-dev.XXXXXX.log")"
DUMP_PID_FILE="$(mktemp "${TMPDIR:-/tmp}/sdui-dump-pid.XXXXXX")"
DUMP_OUT_LOG="$(mktemp "${TMPDIR:-/tmp}/sdui-dump-out.XXXXXX.log")"

GNU mktemp allows the XXXXXX anywhere in the template; BSD mktemp (stock macOS) requires the X's to be the last characters, and treats a template with a suffix after them as a literal filename. Proved on this host:

$ t=$(mktemp "${TMPDIR}/probe-demo.XXXXXX.log"); basename "$t"
probe-demo.XXXXXX.log

So on a Mac the FIRST run creates a file literally named sdui-dump-dev.XXXXXX.log, and every later run fails at that line:

mktemp: mkstemp failed on /var/folders/.../T//sdui-dump-dev.XXXXXX.log: File exists
 ELIFECYCLE  Command failed with exit code 1.

Found while running the pin bump for 00d3f09c500c (#14511): the 2026-09-02 bump's run left the literal file behind, and this bump's pnpm sdui:manifest refused until it was deleted by hand. Same for the pid file and the out log.

Why it matters here

pnpm sdui:manifest is the ADR-0082 D4 declaration-parity ratchet, and by maintainer ruling (2026-08-07) it is an on-demand gate whose only trigger is the pin bump — run by hand, on a laptop, exactly the host where this fails. The failure mode is a hard stop rather than a wrong answer, so it costs a diagnosis rather than a bad record, but it makes the ratchet un-runnable a second time without manual cleanup.

Fix shape

Put the X's last and let the tool pick the name, e.g. mktemp "${TMPDIR:-/tmp}/sdui-dump-dev.XXXXXX" (drop the .log suffix), or create a single mktemp -d scratch directory and place the three named files inside it — the second also gives the script one thing to clean up. Both are portable; the current spelling only works on GNU coreutils.

Same class as the bash-3.2 floor already recorded in scripts/bump-objectui.sh (the mapfile note): these are hand-run operator scripts, so a GNU-only spelling fails on the ordinary host, not a fringe one.

Generated by Claude Code

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions