[Bug]: Cross-drive syntax-error warning can abort extraction on Windows

Đã đóng
#4,147 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.

  • #4149 của @xiehuanyi — đã đóng, không merge

Đá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
25/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
devtools

Hướng nghiên cứu

Start in graphify/extract.py at the syntax-error warning's display-path conversion, then compare it with the adjacent clean-file warning that handles cross-drive paths. Reproduce with the supplied Lua fixture and different Windows drives, using the stated ntpath.relpath check if needed. Done means extraction returns the graph and emits the partial-extraction warning with a usable source path; an open linked pull request already addresses this issue.

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

Mô tả

Pre-flight checks
  • I have checked the Troubleshooting section in the README
What happened?

A source file with recoverable syntax errors can abort extraction when its path and the scan root are on different Windows drives. The syntax-error warning calls os.path.relpath for its display path, and the resulting ValueError escapes instead of returning the extracted graph and warning.

The expected behavior is to return the graph and report the partial-extraction warning with a usable source path. The adjacent warning for a clean file without symbols already handles this drive condition.

Steps to reproduce

Use this Lua input as broken.lua:

local t = {
function f() end

Call graphify.extract.extract([source], root=scan_root) with the included source and scan root on different Windows drives. This report's execution used a controlled macOS probe: the real extraction entry point ran on this fixture, while the source/root relpath conversion used ntpath.relpath with different drives. A same-drive extraction is the control.

The path operation can be checked independently on any platform:

import ntpath
ntpath.relpath("D:/included/broken.lua", "C:/scan-root")
Error output or graph output

Path-sanitized controlled-probe result:

ValueError: path is on mount 'D:', start on mount 'C:'

The exception escapes the syntax-warning display conversion in graphify/extract.py; the extraction call returns no graph and does not emit the intended warning.

Graphify version

0.9.77; source inspected at 5c7b84792f453582676548185aaec3824d51dfe2 on v8.

Operating System

macOS

Python Version

3.12

Installation Method

built from source (git clone)

Additional Environment Details

The source snapshot was tested with local Python dependencies. The cross-drive operation was simulated with Windows path semantics; this is not a native Windows run. No model request is needed. The earlier cache portability path contained the same exception before the warning failed. No written AST cache file was inventoried, and this report makes no cache-file creation claim.

Additional context

This is the syntax-error warning path. #4059 and #4106 address the separate clean-parse, symbol-less warning; their fix is present in the inspected source. This report does not request changes to graph identities, persisted source paths or cache keys.

Ngôn ngữ chính
Python
Star
124k
Fork
11.9k
Merge trung bình
2 giờ 35 phút
Pull request đã merge (30 ngày)
6

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

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

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 Graphify-Labs/graphify

Tất cả issue của Graphify-Labs/graphify

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.