Skip to content

--install's mode-stamp targets prove -w, not that a chmod will succeed (ownership) #48

Closed

Description

@brettheap

--install's mode-stamp targets prove -w before stamping, and -w proves this euid can write a file's contents, not that it can change the file's mode. chmod requires owning the file (or CAP_FOWNER/root); a group- or ACL-writable regular file owned by another account passes every planning check, the cp succeeds, and the later chmod fails — after other artifacts are already placed on the one path in openRepoTools that promises all or none.

Two call sites, both predating PR #44's round 1 (raised again against them in round 2, so filing rather than fixing in that round per the durable word — take what a round introduces, file what predates it):

  • place_skill_and_hook's skill loop, chmod 644 "$target" || die "could not set the mode on $target." — round 2 comment (also flagged at the command-file loop's identical chmod 644, same shape).
  • The present-arm SessionStart hook path, chmod 600 "$settings" || die "could not set mode 600 on $settings, ...".

Related, and not currently guarded at all: the eleven-command bin loop's own mode stamp, chmod 755 "$target" in install_commands, has no || die beside it — unlike the two sites above, a failure there exits under set -e with the shell's own status (1), which this toolset reserves for "findings were printed," not the refusal (2) a mode-stamp failure should read as. Whoever picks this up should fold that in: at minimum, every chmod this command performs should fail through die, whatever is decided about preflighting.

Why PR #44 round 1 declined a preflight rather than fixing it there

The check that would catch this ahead of time is [ -O ] — this euid against the file's owner. Two problems with adding it:

  1. Untestable in this suite. Every fixture in tests/ runs as one account under tmp_path; there is no way to construct a second real owner to prove a [ -O ] guard actually refuses what it claims to, or that it lets through what it should.
  2. It would misfire for root. A root-run --install — provisioning a shared account, say — has its chmod succeed regardless of the target's owner. [ -O ] would refuse that install even though the mode stamp it is worried about would, in fact, succeed.

This is the same shape already ruled on as R-A9-15 (#24 review): a guard no test can reach is a guard nobody can rely on. See the reasoning written into openRepoTools beside unplaceable_kind (search for "WHAT -w DOES NOT PROVE").

What's open

  • Decide whether a narrower, testable guard exists (for example: refuse only when the target's mode is already wrong and its owner is not this euid and this euid is not 0 — narrower than blanket [ -O ], and it would not refuse the root case since root is excluded from the check).
  • At minimum, guard the bin loop's chmod 755 with || die so every mode-stamp failure in this command reads as a refusal (exit 2) rather than the shell's own exit 1.

Filed per PR #44's durable word (lane-collision-protocol convention: take what a round introduces, file what predates it as an issue and resolve the review thread naming the issue).

Activity

  1. brettheap commented on Sep 14, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-14T20:47:28Z, for #48

    Logged in lanes/log/openRepoTools-3.md at 20f0a4c33bacbc277e1017e580f1c483706e0649.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#48:
       none
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#48"`, kept where the row or its body names `#48`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `48` as a whole token:
       none
    
  2. brettheap commented on Sep 16, 2026

    @brettheap
    ContributorAuthor

    RELEASED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-16T00:35:34Z, for #48

  3. brettheap commented on Sep 16, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoTools-1, session df82f553-7803-49c4-8ddf-3f9acdcb8ee0@Eagle, 2026-09-16T01:05:56Z, for #48

    Logged in lanes/log/openRepoTools-1.md at dacf8f1aaedef802a1775ea650e04e19e0951526.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoTools#48:
    6:CLAIMED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-14T20:47:28Z, for opensoft/openRepoTools#48
    13:1. existing `CLAIMED —` comments on opensoft/openRepoTools#48:
    26:RELEASED — lane openRepoTools-3, session 4135b2c9-34a6-47e3-a156-5adebb632fae@Eagle, 2026-09-16T00:35:34Z, for opensoft/openRepoTools#48
    2. `gh pr list --repo opensoft/openRepoTools --state all --search "#48"`, kept where the row or its body names `#48`:
    44	`--install` stamps the documented mode on every artifact and refuses a target it cannot write in the planning phase, and `wip init` stages the template paths it wrote rather than `git add -A -- .`	fix/install-modes-and-wip-init-staging	MERGED
    3. `git ls-remote --heads [email protected]:opensoft/openRepoTools` branches naming `48` as a whole token:
       none
    
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions