microsoft / microsoft/winget-cli
null is being passed to the installer
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Brief description of your issue
null is being passed as a string instead of actual null.
If this is the case for any nulls we are going to have problems with AppsAndFeaturesEntries where either of the fields are null.
For example
AppsAndFeaturesEntries:
- Publisher: null
DisplayName: Brave
DisplayVersion: null
This means in the future winget will be looking for literal null as the Publisher and DisplayVersion
People have also tried to use null as silent switches before because the schema allows it, and i can see the use for null with SilentWithProgress instead of using the silent switch.
Steps to reproduce
Click for Manifest
# yaml-language-server: $schema=https://aka.ms/winget-manifest.singleton.1.1.0.schema.json
PackageIdentifier: null.test
PackageLocale: en-US
PackageVersion: 1.3.3.7
Publisher: BraveSoftware Inc.
PackageName: Brave
License: Test
ShortDescription: null test
InstallerSwitches:
Silent: null
SilentWithProgress: null
Installers:
- Architecture: x64
InstallerType: exe
InstallerUrl: https://github.com/brave/brave-browser/releases/download/v1.37.107/BraveBrowserStandaloneSilentSetup.exe
InstallerSha256: 9BED169B5622A772FC48CA375D76A8B77665047A0A32C77B727AFFB74CE3B676
ManifestType: singleton
ManifestVersion: 1.1.0
winget install -m .\null.test.yaml
PS M:\> winget install -m C:\Users\User\Desktop\null.test.yaml
Found Brave [null.test] Version 1.3.3.7
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://github.com/brave/brave-browser/releases/download/v1.37.107/BraveBrowserStandaloneSilentSetup.exe
██████████████████████████████ 93.4 MB / 93.4 MB
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 2147942487
Click for Log
2022-04-14 10:59:33.144 [CORE] WinGet, version [1.3.431-preview], activity [{1034C7C0-6F0A-48FF-B2EF-95332FACA092}]
2022-04-14 10:59:33.144 [CORE] OS: Windows.Desktop v10.0.22000.556
2022-04-14 10:59:33.144 [CORE] Command line Args: "C:\Users\User\AppData\Local\Microsoft\WindowsApps\winget.exe" install -m C:\Users\User\Desktop\null.test.yaml
2022-04-14 10:59:33.144 [CORE] Package: Microsoft.DesktopAppInstaller v1.18.431.0
2022-04-14 10:59:33.144 [CORE] IsCOMCall:0; Caller: winget-cli
2022-04-14 10:59:33.147 [CLI ] WinGet invoked with arguments: 'install' '-m' 'C:\Users\User\Desktop\null.test.yaml'
2022-04-14 10:59:33.147 [CLI ] Found subcommand: install
2022-04-14 10:59:33.147 [CLI ] Leaf command to execute: root:install
2022-04-14 10:59:33.152 [CLI ] Executing command: install
2022-04-14 10:59:33.152 [CLI ] Manifest fields: Name [Brave], Version [1.3.3.7]
2022-04-14 10:59:33.153 [CLI ] Starting installer selection.
2022-04-14 10:59:33.153 [CLI ] Completed installer selection.
2022-04-14 10:59:33.166 [CLI ] Generated temp download path: C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\9bed169b5622a772fc48ca375d76a8b77665047a0a32c77b727affb74ce3b676
2022-04-14 10:59:33.166 [CORE] Downloading to path: C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\9bed169b5622a772fc48ca375d76a8b77665047a0a32c77b727affb74ce3b676
2022-04-14 10:59:33.166 [CORE] Started applying motw to C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\9bed169b5622a772fc48ca375d76a8b77665047a0a32c77b727affb74ce3b676 with zone: 3
2022-04-14 10:59:33.168 [CORE] Finished applying motw
2022-04-14 10:59:33.168 [CORE] WinINet downloading from url: https://github.com/brave/brave-browser/releases/download/v1.37.107/BraveBrowserStandaloneSilentSetup.exe
2022-04-14 10:59:36.837 [CORE] Download hash: 9bed169b5622a772fc48ca375d76a8b77665047a0a32c77b727affb74ce3b676
2022-04-14 10:59:36.837 [CORE] Download completed.
2022-04-14 10:59:36.838 [CLI ] Installer hash verified
2022-04-14 10:59:36.838 [CORE] Started applying motw using IAttachmentExecute to C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\9bed169b5622a772fc48ca375d76a8b77665047a0a32c77b727affb74ce3b676
2022-04-14 10:59:37.242 [CORE] Finished applying motw using IAttachmentExecute. Result: 0 IAttachmentExecute::Save() result: 0
2022-04-14 10:59:37.242 [CLI ] Successfully renamed downloaded installer. Path: C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\BraveBrowserStandaloneSilentSetup.exe
2022-04-14 10:59:37.246 [REPO] Source named 'msstore' is already defined at origin User. The source from origin Default is dropped.
2022-04-14 10:59:37.246 [REPO] Creating PredefinedInstalledSource with filter [ARP]
2022-04-14 10:59:37.246 [REPO] Creating new SQLite Index [4294967295.4294967295] at ':memory:'
2022-04-14 10:59:37.246 [SQL ] Opening SQLite connection: ':memory:' [6, 0]
2022-04-14 10:59:37.290 [REPO] Examining ARP entries for Machine | X64
2022-04-14 10:59:37.294 [REPO] Examining ARP entries for Machine | X86
2022-04-14 10:59:37.296 [REPO] Examining ARP entries for User | X64
2022-04-14 10:59:37.367 [CLI ] Installer args: null
2022-04-14 10:59:37.368 [CLI ] Starting: 'C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\BraveBrowserStandaloneSilentSetup.exe' with arguments 'null'
2022-04-14 10:59:49.677 [CLI ] ShellExecute installer failed: 2147942487
2022-04-14 10:59:49.677 [CLI ] Terminating context: 0x8a150006 at D:\a\_work\1\s\external\pkg\src\AppInstallerCLICore\Workflows\InstallFlow.cpp:162
Expected behavior
2022-04-14 10:59:37.368 [CLI ] Starting: 'C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\BraveBrowserStandaloneSilentSetup.exe' with arguments ' '
Actual behavior
2022-04-14 10:59:37.368 [CLI ] Starting: 'C:\Users\User\AppData\Local\Temp\WinGet\null.test.1.3.3.7\BraveBrowserStandaloneSilentSetup.exe' with arguments 'null'
Environment
PS M:\> winget --info
Windows Package Manager (Preview) v1.3.431-preview
Windows: Windows.Desktop v10.0.22000.556
Package: Microsoft.DesktopAppInstaller v1.18.431.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in external/pkg/src/AppInstallerCLICore/Workflows/InstallFlow.cpp around line 162 and trace how the manifest's null Silent value becomes installer arguments. Reproduce with the manifest and command shown in the issue, then verify the installer is not launched with the literal argument 'null' and that the expected log output is produced.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100