microsoft / microsoft/winget-cli

Handle scope better

Open
#3,240 16 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Scope Issue-Feature
Dominant language
C++
Stars
26.4k
Forks
1.8k
Avg merge
1d 11h
Merged PRs (30d)
15

Description

Description of the new feature / enhancement

Several packages have been reported to not properly handle "--scope".

The most likely reasons are due to the installer determining scope based on whether the process is elevated, or the user is a member of the local Administrators group.

One example is Git.Git reported at twitter by @woodyinwoodley

The 2.40.1 manifest is specifying an "inno" installer, but it doesn't appear to support the /CURRENTUSER or /ALLUSERS switch.

The manifest does have entries for both "user" and "machine", but those keys don't actually drive the intended behavior.

The default behavior in the installer checks to see if the user is a member of the local Administrators group to determine if the installer will be installed machine wide or per user.

; Note that we write the Registry values below either to HKLM or to HKCU depending on whether the user running the installer
; is a member of the local Administrators group or not (see the "Check" argument).
; Install under HKEY_LOCAL_MACHINE if an administrator is installing.

https://github.com/git-for-windows/build-extra/blob/6fe3f63731fb39e20f7a668fd54566514ecc83af/installer/install.iss#L214

; Install under HKEY_CURRENT_USER if a non-administrator is installing

https://github.com/git-for-windows/build-extra/blob/6fe3f63731fb39e20f7a668fd54566514ecc83af/installer/install.iss#L221

Proposed technical implementation details

We could add another YAML key to indicate that the scope arguments either aren't properly supported, or we could attempt to provide some kind of error messaging to help users understand why their request can't be honored by WinGet.

We could potentially also check to see if the user is in the local Administrator group to determine what output to display.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Git.Git 2.40.1 manifest and the referenced installer/install.iss sections at lines 214 and 221. Trace how the manifest's user and machine entries relate to --scope and how administrator-group membership affects installation. Done means the project has a decided, testable way to represent unsupported scope behavior or explain why a requested scope cannot be honored.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.