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

已关闭
#4,147 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #4149 来自 @xiehuanyi —— 已关闭,未合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
devtools

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
Python
星标
124k
派生
11.9k
平均合并
2 小时 35 分钟
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Graphify-Labs/graphify 的其他 Issue

查看 Graphify-Labs/graphify 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。