C import graph: <sys/types.h> resolves to an unrelated repo header (include/curl/types.h); Stage 1 ignores the include's directory

Abierto Apto para principiantes
#7,827 1 comentario 0 reacciones 0 asignados Ver en GitHub

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
76/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
c, cpp, objective-c, python
Área
devtools

Línea de trabajo

Lee la resolución de importaciones de Stage 1 en gitgalaxy/core/network_risk_sensor.py y la comprobación del contexto de ruta añadida por el issue #3544. Reproduce las aristas falsas notificadas con el comando y la consulta de curl 7.10.8 del issue y, después, aplica la regla de sufijo de ruta para las inclusiones de la familia C que contienen /. El trabajo estará terminado cuando sys/types.h ya no se resuelva como include/curl/types.h y types.h conserve el comportamiento actual.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug

What's wrong. A system include such as #include <sys/types.h> gets an edge to a repository header that merely shares the basename. In curl 7.10.8 (2003), every file under ares/ that includes <sys/types.h> links to include/curl/types.h: 46 false edges out of 479 (import precision 90.4%; 99.6–100% on every other snapshot measured). It reproduces on current main (79b13e354).

Where. gitgalaxy/core/network_risk_sensor.py, Stage 1 of import resolution. When exactly one file matches the token's last segment, it's returned with no check that the token's path context (sys/) is a suffix of the candidate's path. #3544 added exactly that check, but gated on MODULE_PATH_MIRROR_LANGS, so C-family includes skip it. Stage 2 already compares path context when there are several candidates; the single-candidate case is the gap.

Repro.

git -C <curl clone> worktree add /tmp/c7108 curl-7_10_8
galaxyscope /tmp/c7108 --db-only
sqlite3 <db> "select count(*) from edge_data e join file_data s on s.id=e.src_file_id join file_data d on d.id=e.dst_file_id where d.file_path='include/curl/types.h' and s.file_path like 'ares/%'"

ares/ares_init.c:18 is #include <sys/types.h>.

Suggested fix shape. For languages with include_names_file_literally, a token containing / names a file only if the candidate's path ends with that token's path. This is #3544's rule, applied to C/C++/ObjC. A bare "types.h" keeps today's behaviour.

Impact. False in-degree on the matched header, so PageRank, blast radius and the centrality measures are inflated for it. It shows up on any C repo whose headers share names with system headers (types.h, time.h, string.h, signal.h, …).

How it was found. temporal-crucible validated the engine's C function, include and call extraction on curl and nDPI snapshots (2003–2026), running gitgalaxy's own import_graph_accuracy.score_group against each snapshot. Write-up: squid-protocol/temporal-crucible branch validate/engine-c, docs/engine_validation.md.

🤖 Generated with Claude Code

Lenguaje dominante
Python
Estrellas
57
Forks
11
Merge medio
1 h 42 min
PR fusionados (30 d)
966

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de squid-protocol/gitgalaxy

Todos los issues de squid-protocol/gitgalaxy

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.