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

クローズ
#4,147 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

  • #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分
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

Graphify-Labs/graphify のほかの issue

Graphify-Labs/graphify の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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