Git hooks spam ImageMagick 'import' usage on every commit (pipx polyglot shebang misdetected as interpreter)
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Área
- developer-experience, tooling
Línea de trabajo
Comienza con las plantillas de los hooks post-commit y post-checkout o con el código de generación que contiene la sonda GRAPHIFY_PYTHON; después, compara ambas copias. Reproduce el problema con sh -x en un hook instalado, en un entorno con el comando import de ImageMagick, y verifica que la instalación del hook seguida de un commit o checkout no produzca ningún volcado de uso, mientras el grafo se sigue reconstruyendo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 124k
- Forks
- 11.9k
- Merge medio
- 2 h 35 min
- PR fusionados (30 d)
- 6
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Graphify-Labs/graphify
-
[Bug]: Generated git hooks break when CDPATH is exported (dash's cd prints the resolved dir), silently skipping every rebuildPosiblemente ocupada @HhH666-ux la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Graphify-Labs/graphify#4977 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
extract --out <dir>: semantic cache never saved, docs missing from manifest (relative source_file resolved against --out)Posiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Graphify-Labs/graphify#4831 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
hooks: last-resort `python3` probe launches the Microsoft Store redirector on Windows (visible console flash, exit 9009)Posiblemente ocupada @Deepjyoti-Sarmah la tomó hace 16 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Graphify-Labs/graphify#4563 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
GRAPHIFY_DISABLE_THINKING is ignored by the claude backend, so thinking eats max_tokens and extraction truncatesPosiblemente ocupada @bercedev la tomó hace 17 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
Graphify-Labs/graphify#4546 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
--update runbook: graph.json backup instruction comes after the diff that needs it, so the graph diff never runsPosiblemente ocupada @sunildivakar96-cpu la tomó hace 18 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Graphify-Labs/graphify#4539 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de Graphify-Labs/graphify
Issues similares
-
area:docs documentation effort:M ready-for-agent
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
mczielinski/ob-analytics#423 ·
Los mantenedores suelen responder en 1 día
-
flaky: test_ci_eval_scope_exclude never-matches case spends its 1s budget on the rollout waitAbiertoneeds-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
gke-labs/kube-agents#4838 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
danyuchn/asd-ste100-skill#60 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 64/100
Gathin23/cleanyourtv#3299 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
autowarefoundation/autoware_carla_scenario#1485 ·
Los mantenedores suelen responder en 1 día