Skip to content

ci: migrate mktemp -p test-scaffolding call sites to a portable form #1527

Closed

Description

@kyle-sexton

This was generated by AI during work-loop execution.

Context

#1510 ("ci: enable staged shell-portability-lint classes") enables two of the three STAGED
shell-portability-lint classes (date -d, stat -c), fixing/annotating every corpus site each
touches. mktemp -p was deliberately left STAGED in that PR: unlike the other two classes, its
corpus (~24 files, ~56 call sites — scripts/shell-portability-tokens.txt's original "roughly 20
sites" estimate undercounted call sites vs. files) is all shared hook-test scaffolding across ~13
different plugins, none with a BSD-portable counterpart today (BSD mktemp has no -p). Migrating
it is a real, mechanical effort that touches every one of those plugins' release surface (a
plugin.json version bump + CHANGELOG entry per touched plugin under this repo's convention) — out
of scope for #1510's PR, which stays to check-shell-portability.sh/shell-portability-tokens.txt
plus the two dual-dialect script fixes.

Proposed work

  • Migrate each mktemp -p "$DIR" prefix.XXXXXX site to the portable
    mktemp "$DIR/prefix.XXXXXX" form (works identically on GNU and BSD mktemp — the directory rides
    in the template instead of the -p flag).
  • Migrate each mktemp -d -p "$DIR" prefix.XXXXXX site to mktemp -d "$DIR/prefix.XXXXXX".
  • Migrate each bare mktemp -p "$DIR" (no explicit template) site to an explicit-template form,
    e.g. mktemp "$DIR/tmp.XXXXXXXXXX" — do not rely on TMPDIR-inheritance semantics, which differ
    between GNU and BSD mktemp when no template is given.
  • Uncomment the mktemp -p token in scripts/shell-portability-tokens.txt's ACTIVE section once
    the corpus is clean, and update the STAGED section comment to drop the now-resolved entry.
  • Run scripts/check-shell-portability.sh --all after uncommenting and confirm it is clean (or
    every remaining hit carries a reviewed portability-ok:).
  • Bump plugin.json's version and add a CHANGELOG entry for every plugin whose test-scaffolding
    files are touched.

Acceptance criteria

  • Every mktemp -p/mktemp -d -p call site in the corpus (enumerate fresh via
    grep -rn "mktemp[^\n]*-p" --include="*.sh" at execution time — the count above is a
    snapshot, not a fixed list) is migrated to a portable form, or carries a reviewed
    portability-ok: annotation with a stated reason.
  • The mktemp -p token in scripts/shell-portability-tokens.txt is uncommented (moved to the
    ACTIVE section).
  • scripts/check-shell-portability.sh --all exits 0 against the full repo.
  • bash scripts/check-shell-portability.test.sh still passes (the staged-classes-inactive test
    at the bottom of that suite needs updating once all three classes are active).
  • Every touched plugin's plugin.json version is bumped with a matching CHANGELOG entry.

References

Metadata

Field Value
Category unspecified
Area security
Ecosystem unspecified

Activity

  1. added
    area: security
    on Jul 26, 2026
  2. added
    status: ready
    agent-ready
    on Jul 26, 2026
  3. added theissue type on Jul 26, 2026
  4. kyle-sexton commented on Jul 26, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Triage

    Verification: confirmed by direct source read. scripts/shell-portability-tokens.txt's STAGED
    section (current main, post-#1511/#1519/#1533) still comments out mktemp -p, with the section
    header pointing at #1510 as the enable trigger — matches the issue's premise. Corpus re-counted
    fresh: grep -rln 'mktemp[^\n]*-p' --include='*.sh' . finds 24 files / 63 call sites repo-wide —
    same order of magnitude as the issue's "~24 files, ~56 call sites" estimate (undercounted, as the
    issue itself flagged).

    Important correction to this issue's own premise, found while cross-checking #1510: #1510 has
    not merged yet (still claimed/leased, no PR opened as of this triage pass) — this issue's
    framing ("#1510... enables two of the three STAGED classes... mktemp -p was deliberately left
    STAGED in that PR") describes a PR that does not exist yet. #1510's own triage comment recorded a
    different decision-defaulted plan than this issue assumes: uncomment all three STAGED
    classes (including mktemp -p) in the same pass, applying portability-ok: annotations to the
    mktemp -p sites rather than migrating them — not leaving mktemp -p staged. Whichever way #1510
    actually lands, this issue's underlying ask (real portable-form migration of the mktemp -p corpus,
    not just an annotation) is legitimate follow-up work either way — it is not blocked by or redundant
    with #1510's resolution, since annotating now and migrating for real later are compatible, sequential
    steps. Flagging this so the eventual implementer verifies the token-file's actual STAGED/ACTIVE and
    annotation state fresh rather than assuming this issue's snapshot.

    Classification

    • Type: Task (native Issue Type set — mechanical migration, not a functional bug).
    • Priority: priority: low (already applied) — test-scaffolding-only, no functional/consumer impact,
      matches sibling ci: enable staged shell-portability-lint classes (date -d, stat -c, mktemp -p) #1510's own assessed tier.
    • Target state: briefed, delegable. The migration pattern is fully specified (drop -p, fold the
      directory into the template) and mechanical; the version-bump/CHANGELOG convention is this repo's
      documented, not a judgment call.

    Agent Brief

    Type: Task
    Summary: Migrate every mktemp -p / mktemp -d -p call site in the shared hook-test scaffolding
    corpus to the portable templated form, then activate the shell-portability-lint gate's mktemp -p
    detection class.

    Current behavior: mktemp -p <dir> <template> and bare mktemp -p <dir> are GNU-only forms with
    no BSD mktemp equivalent (BSD mktemp has no -p flag). The shell-portability-lint gate's
    mktemp -p detection class is currently staged (inactive) pending this migration — or, if #1510 has
    by then activated it with portability-ok: annotations on these sites instead of migrating them,
    pending replacement of those annotations with real fixes.

    Desired behavior: Every mktemp -p "$DIR" prefix.XXXXXX site becomes
    mktemp "$DIR/prefix.XXXXXX"; every mktemp -d -p "$DIR" prefix.XXXXXX site becomes
    mktemp -d "$DIR/prefix.XXXXXX"; every bare mktemp -p "$DIR" (no explicit template) site becomes
    an explicit-template form such as mktemp "$DIR/tmp.XXXXXXXXXX" (do not rely on TMPDIR-inheritance
    semantics, which differ between GNU and BSD mktemp when no template is given). This is a drop-in
    behavioral equivalent on both GNU and BSD mktemp — the directory rides in the template instead of
    the -p flag. Once the corpus is migrated (not merely annotated), the mktemp -p token in the
    shell-portability-lint token list is active (uncommented) with no outstanding STAGED comment for it,
    and the gate exits clean against the full repo.

    Key interfaces:

    • The shell-portability-lint token list's ACTIVE/STAGED sections (mktemp -p entry).
    • Every hook-test scaffolding script across the affected plugins that calls mktemp -p.

    Acceptance criteria:

    • Every mktemp -p / mktemp -d -p call site in the corpus (re-enumerate fresh at execution
      time — the count here is a snapshot, not a fixed list) is migrated to a portable form, with no
      reliance on a portability-ok: annotation as the resolution.
    • The mktemp -p token is active (ACTIVE section) in the shell-portability-lint token list, with
      no STAGED comment remaining for it.
    • The shell-portability-lint gate exits 0 against the full repo.
    • The shell-portability-lint test suite passes in full (including any staged-classes-inactive
      assertion that needs updating once all three classes are active).
    • Every plugin whose test-scaffolding files are touched gets a plugin.json version bump and a
      matching CHANGELOG entry, per this repo's convention.

    Out of scope:

    Labels applied: agent-ready (autonomous-eligible role label), status: ready. priority: low
    unchanged. Role label resolved from tracker defaults — .work-item-tracker.json carries no
    role_labels remap.

    Related: #1510 (parent — enable trigger and sibling classes; verify its actual landed state before
    starting this item), #1491 (origin gate), #1528 (closed duplicate of this issue).

  5. self-assigned this
    on Jul 26, 2026
  6. kyle-sexton commented on Jul 26, 2026

    @kyle-sexton
    MemberAuthor
    No description provided.
  7. kyle-sexton commented on Jul 26, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during work-loop execution.

    Work-loop autonomous execution: claimed via the work-item-tracker seam, implemented on branch chore/1527-mktemp-p-portable-migration in an isolated worktree, opened PR #1543 (not merged — merge authority belongs to the babysit-loop lane or a human).

    Summary: migrated all 61 mktemp -p/mktemp -d -p call sites (24 files, 13 plugins) to the portable mktemp [-d] "$DIR/template" form, activated the mktemp -p token in scripts/shell-portability-tokens.txt, updated the staged-classes test, bumped plugin.json + CHANGELOG for all 13 touched plugins. Filed follow-up #1540 for 68 pre-existing, unrelated --all-mode findings that predate this change and are out of scope for a mktemp-only migration. Full detail in the PR description.

  8. added 4 commits that reference this issue on Jul 26, 2026
    403873d
    d1d048b
    91327a0
    321c8ba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent-readyarea: securitystatus: ready

Type

Fields

No fields configured for Task.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions