Git hooks spam ImageMagick 'import' usage on every commit (pipx polyglot shebang misdetected as interpreter)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
GRAPHIFY_PYTHON プローブを含む post-commit および post-checkout フックのテンプレートまたは生成コードから始め、続いて両方のコピーを比較します。ImageMagick の import コマンドがある環境で、インストール済みのフックに対して sh -x を使用して再現し、フックのインストール後に commit または checkout を実行しても usage ダンプが生成されず、グラフは引き続き再構築されることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Summary
The installed post-commit / post-checkout git hooks print ImageMagick's import usage dump on every commit and checkout when the graphify launcher uses a #!/bin/sh polyglot shebang (the pipx-installed layout). The graph still rebuilds correctly via the python3 fallback, so it's cosmetic — but it spams several dozen lines of Usage: import [options ...] into the output of every git commit.
Environment
- graphify (pip package
graphifyy) 0.4.12, installed via pipx - macOS (Apple Silicon), Homebrew ImageMagick present on
PATH(provides a binary namedimport)
Root cause
The pipx launcher ~/.local/bin/graphify starts with a polyglot shebang that re-execs into the venv Python:
#!/bin/sh
'''exec' "/…/pipx/venvs/graphifyy/bin/python" "$0" "$@"
' '''
import sys
from graphify.__main__ import main
The hook detects the interpreter by reading the launcher's first line:
_SHEBANG=$(head -1 "$GRAPHIFY_BIN" | sed 's/^#![[:space:]]*//')
For this launcher that yields GRAPHIFY_PYTHON=/bin/sh. The hook then validates it with:
if [ -n "$GRAPHIFY_PYTHON" ] && ! "$GRAPHIFY_PYTHON" -c "import graphify" 2>/dev/null; then
which runs /bin/sh -c "import graphify". On any machine with ImageMagick on PATH, import is ImageMagick's screen-capture tool, so it prints its full usage text to stdout (the probe only redirects stderr). The check's exit code still works, so GRAPHIFY_PYTHON is reset and the python3 fallback runs — the graph rebuilds fine, but the usage dump already leaked to the terminal.
sh -x .git/hooks/post-commit trace:
+ GRAPHIFY_PYTHON=/bin/sh
+ /bin/sh -c 'import graphify'
Usage: import [options ...] [ file ]
...
+ GRAPHIFY_PYTHON=
+ python3 -c 'import graphify' # fallback, works
Suggested fixes (either/both)
-
Silence the probe's stdout too — it's only used for its exit status:
! "$GRAPHIFY_PYTHON" -c "import graphify" >/dev/null 2>&1(applies to the same probe in both
post-commitandpost-checkout) -
Don't trust a
/bin/shshebang as the interpreter — the launcher is a polyglot; reject shebangs whose basename isn't apython*before probing (or just skip straight to thepython3/pythonfallback when it isn't).
Fix #1 alone removes the noise for any stray interpreter guess; #2 addresses the misdetection at its source.
Workaround
Add >/dev/null 2>&1 to the probe line in the installed .git/hooks/post-commit and .git/hooks/post-checkout, but graphify hook install regenerates them and reintroduces the noise.
- 主要言語
- Python
- スター
- 124k
- フォーク
- 11.9k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Graphify-Labs/graphify のほかの issue
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)対応中かも @Deepjyoti-Sarmah が 5 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Graphify-Labs/graphify#4563 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncates対応中かも @bercedev が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 69/100
Graphify-Labs/graphify#4546 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runs対応中かも @sunildivakar96-cpu が 7 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Graphify-Labs/graphify#4539 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Bug] Pi skill uses unsupported general-purpose subagent instead of delegate再び着手できるかも @bercedev が 8 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
Graphify-Labs/graphify#4494 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
Graphify-Labs/graphify#3763 ·
メンテナーはふだん 1 日以内に返信
Graphify-Labs/graphify の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
conda-forge/conda-forge-bot#7025 ·
メンテナーはふだん 1 日以内に返信
-
area:ci
難易度 1/5 1時間未満 初心者へのやさしさ 74/100
catincloud-labs/dagster-dex#149 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
home-assistant/core#188424 ·
メンテナーはふだん 1 日以内に返信
-
Review backlog (docs-currency): README 'CI run' link lands on a run whose overall badge is cancelledオープンagent/reviewer needs-kind needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
projectbluefin/utah#880 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
redis/memtier_benchmark#850 ·
メンテナーはふだん 1 日以内に返信