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

Đang mở Phù hợp với người mới
#7,827 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
c, cpp, objective-c, python
Lĩnh vực
devtools

Hướng nghiên cứu

Đọc phần phân giải import Stage 1 trong gitgalaxy/core/network_risk_sensor.py và kiểm tra ngữ cảnh đường dẫn được thêm bởi issue #3544. Tái hiện các cạnh sai đã được báo cáo bằng lệnh và truy vấn curl 7.10.8 trong issue, sau đó áp dụng quy tắc hậu tố đường dẫn cho các include thuộc họ C có chứa /. Hoàn tất khi sys/types.h không còn được phân giải thành include/curl/types.h, trong khi types.h vẫn giữ nguyên hành vi hiện tại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
57
Fork
11
Merge trung bình
1 giờ 46 phút
Pull request đã merge (30 ngày)
972

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của squid-protocol/gitgalaxy

Tất cả issue của squid-protocol/gitgalaxy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.