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

オープン 初心者向け
#7,827 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
c, cpp, objective-c, python
領域
devtools

調査の方向性

gitgalaxy/core/network_risk_sensor.py の Stage 1 のインポート解決と、issue #3544 で追加されたパスコンテキストのチェックを読みます。issue に記載された curl 7.10.8 のコマンドとクエリで報告された誤ったエッジを再現し、その後、/ を含む C 系 include にパスサフィックス規則を適用します。sys/types.h が include/curl/types.h に解決されなくなり、types.h は現在の動作を維持すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Python
スター
57
フォーク
11
平均マージ
1時間 42分
マージ済み PR(30日)
966

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

squid-protocol/gitgalaxy のほかの issue

squid-protocol/gitgalaxy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。