Repository navigation
fix: Windows で通知や報告に出すパスから \\?\ を外す - #137
Merged
Merged
Conversation
Windows で、depup が利用者に見せるメッセージのファイルのパスに、拡張長 パスの接頭辞 \\?\ が付いていた。ルートに minimumReleaseAge を持つ pnpm workspace で depup --age 2w --dry-run を実行すると "(10 days from \\?\C:\work\app\pnpm-workspace.yaml)" のように表示され、 install の復元の報告 (recovery failed for \\?\C:\...\Cargo.lock: ...) も 同じ形になっていた。 std::fs::canonicalize は Windows で \\?\ 付きのパス (verbatim path) を返す。 age の設定の出どころ (orchestrator/age.rs) や install の復元の報告 (install/transaction.rs の RollbackReport::print) は、正規化したパスを そのまま display() で表示していた。cargo_rollback/scratch.rs には同じ 接頭辞を外す strip_verbatim_prefix があったが、表示の側では使っていなかった。 - user_path モジュールを足し、strip_verbatim_prefix を cargo_rollback から 移して共有する。利用者に見せるパスは for_display で \\?\ を外して表示する (\\?\C:\... は C:\...、\\?\UNC\server\share\... は \\server\share\...)。 ファイルの操作と比較には元のパスを使う (長いパスは \\?\ がないと開けない ことがある)。 - age の設定の通知と、install の復元の報告 (Scope・restored・removed・ recovery failed・kept・写しの場所) で for_display を使う。 - AGENTS.md に書いた。 テスト: 正規化したパスの表示に \\?\ が付かず、表示したパスを正規化すると 元のパスに戻ること。age の通知の設定ファイルのパスに \\?\ が付かないこと。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
Windows で、depup が利用者に見せるメッセージのファイルのパスに、拡張長パスの接頭辞
\\?\が付いていました。ルートにminimumReleaseAgeを持つ pnpm workspace でdepup --age 2w --dry-runを実行すると(10 days from \\?\C:\work\app\pnpm-workspace.yaml)のように表示され、install の復元の報告 (recovery failed for \\?\C:\...\Cargo.lock: ...) も同じ形になっていました。表示では接頭辞を外します。原因
std::fs::canonicalizeは Windows で\\?\付きのパス (verbatim path) を返します。age の設定の出どころ (orchestrator/age.rs) や install の復元の報告 (install/transaction.rsのRollbackReport::print) は、正規化したパスをそのままdisplay()で表示していました。cargo_rollback/scratch.rsには同じ接頭辞を外すstrip_verbatim_prefixがありましたが、表示の側では使っていませんでした。変更内容
user_pathモジュールを足し、strip_verbatim_prefixをcargo_rollbackから移して共有する。利用者に見せるパスはfor_displayで\\?\を外して表示する (\\?\C:\...はC:\...、\\?\UNC\server\share\...は\\server\share\...)。for_displayを使う。ファイルの操作と比較には元のパスを使います。正規化の結果そのものから接頭辞を外すと、長いパス (
\\?\がないと開けないことがある) の操作に影響するためです。この PR は #108 (通知を 1 回だけ出す) の変更の上に作っています。検証
orchestrator::tests::age_notices_show_paths_without_the_verbatim_prefix(age の通知の設定ファイルのパスに\\?\が付かない)user_path::tests::displayed_paths_have_no_verbatim_prefix(正規化したパスの表示に\\?\が付かず、表示したパスを正規化すると元のパスに戻る)user_path::tests::test_strip_verbatim_prefix_on_windows(cargo_rollbackから移したテスト)cargo fmt --all -- --check: passcargo clippy --locked --all-targets -- -D warnings: passcargo test --locked(Windows): passCloses #126
🤖 Generated with Claude Code