Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed in renaming the installer if the InstallerUrl contains invalid filename characters #2682

Closed
SpecterShell opened this issue Nov 8, 2022 · 1 comment · Fixed by #2708
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@SpecterShell
Copy link
Contributor

SpecterShell commented Nov 8, 2022

Brief description of your issue

After downloading the installer, WinGet will rename it according to the URL.
However, if the URL contains invalid characters such as *, the renaming will fail.

EDIT: A workaround is to encode these characters in advance when filling in the manifest, and WinGet will not decode them when renaming.

Examples:
microsoft/winget-pkgs#87776

Steps to reproduce

  1. Use one of the following URLs as InstallerUrl in the manifest:
  2. Use winget install -m .\path\to\the\manifest to install
  3. Installation fails

Expected behavior

Rename the file according to the response header Content-Disposition instead of the URL.

Actual behavior

Renaming failed and installation stopped.
The following log comes from the validation pipeline. It is the same on my device.

2022-11-08 04:20:46.488 [CORE] WinGet, version [1.3.2091], activity [{847589FC-8A14-405D-A00F-9814D8D240EB}]
2022-11-08 04:20:46.489 [CORE] OS: Windows.Desktop v10.0.19044.1889
2022-11-08 04:20:46.489 [CORE] Command line Args: C:\Users\validator\AppData\Local\Microsoft\WindowsApps\winget.exe install --manifest D:\TRANSFER\9602fc98-5f5f-ed11-9566-0022484bf065\Manifest.yaml --scope user --accept-package-agreements
2022-11-08 04:20:46.489 [CORE] Package: Microsoft.DesktopAppInstaller v1.18.2091.0
2022-11-08 04:20:46.489 [CORE] IsCOMCall:0; Caller: winget-cli
2022-11-08 04:20:46.503 [CLI ] WinGet invoked with arguments: 'install' '--manifest' 'D:\TRANSFER\9602fc98-5f5f-ed11-9566-0022484bf065\Manifest.yaml' '--scope' 'user' '--accept-package-agreements'
2022-11-08 04:20:46.503 [CLI ] Found subcommand: install
2022-11-08 04:20:46.503 [CLI ] Leaf command to execute: root:install
2022-11-08 04:20:46.518 [CLI ] Executing command: install
2022-11-08 04:20:46.528 [CLI ] Manifest fields: Name [支付宝开放平台密钥工具], Version [2.0.0]
2022-11-08 04:20:46.533 [CLI ] Starting installer selection.
2022-11-08 04:20:46.533 [CLI ] Installer [X64,nullsoft,Machine,] not applicable: Installer scope does not match required scope: Machine != User
2022-11-08 04:20:46.533 [CLI ] Completed installer selection.
2022-11-08 04:20:46.566 [CLI ] Generated temp download path: C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3
2022-11-08 04:20:46.567 [CORE] Downloading to path: C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3
2022-11-08 04:20:46.567 [CORE] DeliveryOptimization downloading from url: https://mdn.alipayobjects.com/ind_developertool/afts/file/A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ?af_fileName=AlipayKeyTool-2.0.0.exe
2022-11-08 04:20:52.642 [CORE] Download completed.
2022-11-08 04:21:02.832 [CORE] Started applying motw to C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3 with zone: 3
2022-11-08 04:21:02.837 [CORE] Finished applying motw
2022-11-08 04:21:02.839 [CLI ] Installer hash verified
2022-11-08 04:21:02.840 [CORE] Started applying motw using IAttachmentExecute to C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3
2022-11-08 04:21:17.643 [CORE] Finished applying motw using IAttachmentExecute. Result: 0 IAttachmentExecute::Save() result: 0
2022-11-08 04:21:17.645 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(80)\WindowsPackageManager.dll!00007FFAB5B0B7B5: (caller: 00007FFAB593FD8C) LogHr(1) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:17.645 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(92)\WindowsPackageManager.dll!00007FFAB5B0B7EC: (caller: 00007FFAB593FD8C) LogHr(2) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:19.477 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(103)\WindowsPackageManager.dll!00007FFAB5B0B823: (caller: 00007FFAB593FD8C) LogHr(3) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:24.872 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(103)\WindowsPackageManager.dll!00007FFAB5B0B823: (caller: 00007FFAB593FD8C) LogHr(4) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:32.221 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(103)\WindowsPackageManager.dll!00007FFAB5B0B823: (caller: 00007FFAB593FD8C) LogHr(5) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:32.336 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(103)\WindowsPackageManager.dll!00007FFAB5B0B823: (caller: 00007FFAB593FD8C) LogHr(6) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:32.445 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(103)\WindowsPackageManager.dll!00007FFAB5B0B823: (caller: 00007FFAB593FD8C) LogHr(7) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: rename: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:32.446 [FAIL] D:\a\_work\1\s\external\pkg\src\AppInstallerCommonCore\Filesystem.cpp(118)\WindowsPackageManager.dll!00007FFAB5B0B85A: (caller: 00007FFAB593FD8C) LogHr(8) tid(1868) 8007023E {Application Error}

The exception %s (0x    Msg:[std::exception: create_hard_link: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"] 

2022-11-08 04:21:34.118 [CLI ] Caught std::exception: copy_file: The filename, directory name, or volume label syntax is incorrect.: "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\a61dac056d575d2d350125616d8db9d7a67e35ad7361ea6750be1ebebae450f3", "C:\Users\VALIDA~1\AppData\Local\Temp\WinGet\Alibaba.AlipayKeyTool.2.0.0\A*Es2PTIHkkdwAAAAAAAAAAAAADlx-AQ.exe"

Environment

Windows 程序包管理器(预览) v1.4.2161-preview
版权所有 (C) Microsoft Corporation。保留所有权利。

Windows: Windows.Desktop v10.0.22621.755
系统体系结构: X64
程序包: Microsoft.DesktopAppInstaller v1.19.2161.0
@ghost ghost added the Needs-Triage Issue need to be triaged label Nov 8, 2022
@denelon
Copy link
Contributor

denelon commented Nov 14, 2022

@ryfu-msft I just wanted to bring this to your attention.

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage Issue need to be triaged labels Nov 14, 2022
@yao-msft yao-msft linked a pull request Nov 17, 2022 that will close this issue
@denelon denelon added this to the v1.4-Client milestone Nov 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants