Localized git output defeats ErrNotRepo; stored runs refused outside a repo
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Read internal/gitx/gitx.go, especially baseEnv and runEnv, then trace how internal/engine/engine.go handles ErrNotRepo. Start by running the relevant gitx tests and add coverage for LANGUAGE=de on a non-repository. Done when locale-pinned git calls return ErrNotRepo and spackle runs works with its state directory outside a repository; run make test-short and make lint.
由索引模型根據 Issue 內容生成。
描述
Summary
gitx recognizes "not a git repository" by matching English stderr text and does not pin the locale, so on a machine where git prints translated messages every command that reads stored runs is refused when the state directory is outside a repository.
Where
internal/gitx/gitx.go:370(runEnvmatches"not a git repository")internal/gitx/gitx.go:376(matches"lazy fetching disabled")internal/gitx/gitx.go:71-93(baseEnvsets noLC_ALLorLANGUAGE)internal/engine/engine.go:166-172(CheckStateDirrefuses on any other error)internal/cli/runs.go:111,internal/mcp/tools.go:702(callers)
Details
baseEnv passes the operator's environment through and adds GIT_* variables only. git translates this message; with a German locale it reads "Kein Git-Repository ...". The error then falls through to the generic git rev-parse ... error, and CheckStateDir treats every TopLevel error that is not ErrNotRepo as "git cannot read the repository around " and returns a refusal.
Not reproduced on the audit machine: Git for Windows ships no translations. The code path was read end to end, and the message is a translated string in git builds with gettext (distribution packages on Linux, Homebrew on macOS).
Impact
On such a machine, for a scan of a plain directory, a live URL or a git URL run from a directory that is not a checkout, the scan works and creates the run, and then spackle runs, report, verify, baseline, runs compare, runs prune, scan --resume and the MCP tools list_runs, get_report, get_finding, compare_runs all fail with a message that tells the operator to fix a repository that does not exist. The other ErrNotRepo callers only lose a clearer message.
Steps to reproduce
- On Linux with the git translations installed:
mkdir /tmp/plain && cd /tmp/plain && echo 'x=1' > a.py && spackle scan . LANG=de_DE.UTF-8 LANGUAGE=de spackle runs- Expected: the run is listed. Actual: "git cannot read the repository around .spackle/runs", exit 3.
Suggested fix
Append LC_ALL=C and LANGUAGE=C in baseEnv (after dropping inherited values) so every message gitx parses is the untranslated one. Longer term, decide "not a repository" from git rev-parse --git-dir exit status, not stderr text.
Acceptance criteria
-
baseEnvpins the message locale - A test sets
LANGUAGE=deand assertsTopLevelon a non-repository returnsErrNotRepo(skipped when git has no translations) -
spackle runsworks for a state directory outside any repository withLANG=de_DE.UTF-8
Getting started
- Relevant files: internal/cli/runs.go, internal/engine/engine.go, internal/gitx/gitx.go
- How to run tests:
make test-short(Unix) or.\make.ps1 test-short(Windows PowerShell);make lintbefore you call it done - Related docs: CONTRIBUTING.md, docs/ARCHITECTURE.md
Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: S. audit-key: bug|internal/gitx/gitx.go|runEnv
- 主要語言
- Go
- 星號
- 0
- 分支
- 1
- 平均合併
- 8 小時 14 分鐘
- 30 天內合併 PR
- 3
環境準備
在瀏覽器裡用你自己的 GitHub 帳號啟動這個專案的開發容器。
- 提供 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
TMHSDigital/Spackle 的其他 Issue
-
ci good first issue severity: low
難度 2/5 1-3 小時 新手友好度 77/100
TMHSDigital/Spackle#206 ·
維護者通常 1 天內回覆
-
ci severity: low
難度 2/5 1-3 小時 新手友好度 78/100
TMHSDigital/Spackle#205 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 82/100
TMHSDigital/Spackle#199 ·
維護者通常 1 天內回覆
-
bug good first issue severity: low
難度 2/5 1-3 小時 新手友好度 87/100
TMHSDigital/Spackle#195 ·
維護者通常 1 天內回覆
-
documentation good first issue severity: medium
難度 1/5 1 小時以內 新手友好度 90/100
TMHSDigital/Spackle#188 ·
維護者通常 1 天內回覆
查看 TMHSDigital/Spackle 的全部 Issue
相似的 Issue
-
bug effort:s impact:med raised-by:worker risk:low to:worker
難度 2/5 1-3 小時 新手友好度 78/100
medici-finance/assay#8120 · 1 則留言 ·
維護者通常 1 天內回覆
-
factory:subtask
難度 1/5 1 小時以內 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 77/100
agent-substrate/substrate#4308 ·
維護者通常 2 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
celestiaorg/celestia-app#8877 ·
維護者通常 1 天內回覆
-
sweep
難度 1/5 1 小時以內 新手友好度 84/100
bketelsen/truenas-mcp#112 ·
維護者通常 1 天內回覆