fix(local): shell-quote git args in the auto-patch push and trial-build gate #126

Merged
pat-s merged 1 commit from t3code/fix-git-shell-quoting into main 2026-07-15 15:43:03 +00:00
Owner

Problem

The first real auto-apply-patches run classified, limited to the top-10, and validated the candidate registry cleanly, then died at the push step:

Validating candidate registry:
  Patch registry OK (13 entries).
sh: syntax error: unexpected "("
Error in git("commit", "-m", ...): git commit -m feat(patches): auto-propose 10 registry entries ... failed

Root cause: R's system2() with captured output (stdout=TRUE) runs the command through /bin/sh, and the arguments were passed unquoted. The commit message feat(patches): ... contains (), which the shell tried to interpret. The same class of bug affects the ^{commit} and ref:path git refs in the trial-build gate.

Fix

shQuote() every git argument:

  • propose-patches.R -- the git() helper used by --open-pr (commit, push, checkout).
  • trial-build-registry.R -- the base-ref reads (rev-parse ... ^{commit}, ls-tree, show ref:path).

Verification

  • Reproduced against a real git repo: the unquoted call fails with status 2 (the same unexpected "("); the shQuoted call commits successfully, and rev-parse HEAD^{commit} resolves.
  • 105 tests pass; all pre-commit hooks pass.

Everything else in that run was correct: 842,659 failing builds classified, RcppParallel's 895 dependents correctly reported as blocked (not proposed), top-10 tbb-stddef candidates selected, 69 deferred, registry validated. Only the shell quoting was broken.

## Problem The first real `auto-apply-patches` run classified, limited to the top-10, and validated the candidate registry cleanly, then died at the push step: ``` Validating candidate registry: Patch registry OK (13 entries). sh: syntax error: unexpected "(" Error in git("commit", "-m", ...): git commit -m feat(patches): auto-propose 10 registry entries ... failed ``` Root cause: R's `system2()` with captured output (`stdout=TRUE`) runs the command through `/bin/sh`, and the arguments were passed **unquoted**. The commit message `feat(patches): ...` contains `()`, which the shell tried to interpret. The same class of bug affects the `^{commit}` and `ref:path` git refs in the trial-build gate. ## Fix `shQuote()` every git argument: - `propose-patches.R` -- the `git()` helper used by `--open-pr` (commit, push, checkout). - `trial-build-registry.R` -- the base-ref reads (`rev-parse ... ^{commit}`, `ls-tree`, `show ref:path`). ## Verification - Reproduced against a real git repo: the unquoted call fails with status 2 (the same `unexpected "("`); the `shQuote`d call commits successfully, and `rev-parse HEAD^{commit}` resolves. - 105 tests pass; all pre-commit hooks pass. Everything else in that run was correct: 842,659 failing builds classified, RcppParallel's 895 dependents correctly reported as blocked (not proposed), top-10 tbb-stddef candidates selected, 69 deferred, registry validated. Only the shell quoting was broken.
The autonomous --open-pr run failed at `git commit` with
`sh: syntax error: unexpected "("`: R's system2() with captured output runs the
command through /bin/sh, and the commit message `feat(patches): ...` (and the
`^{commit}` / `ref:path` git refs in the trial-build gate) contain shell
metacharacters that were passed unquoted.

shQuote() every git argument in propose-patches.R's git() helper and in
trial-build-registry.R's base-ref reads. Reproduced the failure and verified the
fix against a real git repo (commit with "()" in the message now succeeds; a
`HEAD^{commit}` rev-parse resolves).
pat-s merged commit ff9f5f5177 into main 2026-07-15 15:43:03 +00:00
pat-s deleted branch t3code/fix-git-shell-quoting 2026-07-15 15:43:03 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
devxy/build-cran-binaries!126
No description provided.