Portable install deletes the executable when PortableCommandAlias differs from the file name only by case
維護者通常 2 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
閱讀 src/AppInstallerCLICore/Workflows/PortableFlow.cpp 中的兩個硬連結檢查處,以及 src/AppInstallerCLICore/PortableInstaller.cpp 中的 SetExpectedState。比較別名和可執行檔名稱僅大小寫不同時的處理方式,接著執行相關的 portable 安裝測試。當安裝一個別名僅與可執行檔名稱大小寫不同的 portable 套件成功,且該別名能啟動可執行檔時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
Relevant area(s)
WinGet CLI
Relevant command(s)
winget install
Brief description of your issue
Since hardlink aliases arrived in #6308, a zip portable fails to install when PortableCommandAlias matches the nested executable's name except for case. Blinue.Magpie 0.13.0 has RelativeFilePath: Magpie.exe and PortableCommandAlias: magpie (microsoft/winget-pkgs#490991).
PortableFlow.cpp creates a hardlink when commandAlias != originalFilename (line 255, and the same check on line 298 for single-file portables). std::filesystem::path compares case-sensitively, so magpie.exe and Magpie.exe count as different names. On NTFS they are the same file. The install removes the "existing hardlink" magpie.exe, which deletes Magpie.exe, and then create_hard_link and the copy fallback both fail. PortableInstaller::SetExpectedState makes the same comparison (line 595).
The failed install also leaves the package folder behind with only the portable index .db in it.
Steps to reproduce
winget install --source winget --id Blinue.Magpie --exact --scope user
Expected behavior
Magpie installs and magpie starts it.
Actual behavior
copy_file: The system cannot find the file specified.: "...\Blinue.Magpie_Microsoft.Winget.Source_8wekyb3d8bbwe\Magpie.exe", "...\magpie.exe"
Portable install failed; Cleaning up...
From the log:
[CORE] Removing existing portable hardlink at: ...\magpie.exe
[CORE] Creating hardlink at: ...\magpie.exe pointing to: ...\Magpie.exe
[CORE] Hardlink not supported or creation failed: create_hard_link: The system cannot find the file specified.
[CORE] Hardlink creation failed, falling back to copy: ...\magpie.exe
[CLI ] Caught std::exception: copy_file: The system cannot find the file specified.
[CLI ] Terminating context: 0x8a150057 at ...\PortableFlow.cpp:165
The same manifest without the alias installs and runs fine (tested with winget install --manifest), so I sent that as a workaround in microsoft/winget-pkgs#491068. A fix here would be to compare the alias and the file name case-insensitively at all three spots, so a case-only difference skips the hardlink.
Environment
Windows Package Manager v1.30.310
Windows 11 Pro 25H2 (10.0.26200), x64
- 主要語言
- C++
- 星號
- 26.6k
- 分支
- 1.8k
- 平均合併
- 2 天 18 小時
- 30 天內合併 PR
- 42
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
microsoft/winget-cli 的其他 Issue
-
Issue-Docs Needs-Triage
難度 2/5 1-3 小時 新手友好度 70/100
microsoft/winget-cli#6692 ·
維護者通常 2 天內回覆
-
Issue-Docs Possible-Duplicate
難度 2/5 1-3 小時 新手友好度 76/100
microsoft/winget-cli#6493 · 1 則留言 ·
維護者通常 2 天內回覆
-
Issue-Feature
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/winget-cli#6427 ·
維護者通常 2 天內回覆
-
Issue-Docs msstore
難度 2/5 1-3 小時 新手友好度 64/100
microsoft/winget-cli#6331 · 1 則留言 ·
維護者通常 2 天內回覆
-
Command-Source Issue-Bug
難度 2/5 1-3 小時 新手友好度 68/100
microsoft/winget-cli#6148 ·
維護者通常 2 天內回覆
查看 microsoft/winget-cli 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 84/100
telefonicaid/fiware-orion#4836 ·
維護者通常 1 天內回覆
-
refactor topic-ui topic-weather
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
leanprover/lean4#16810 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 72/100