winget-cli icon indicating copy to clipboard operation
winget-cli copied to clipboard

Path environment variable modification does not actually modify PATH.

Open mrexodia opened this issue 4 months ago • 5 comments

Relevant area(s)

WinGet CLI

Relevant command(s)

winget install

Brief description of your issue

I was trying to add the latest version of x64dbg to winget. There is no installer, so you have to use the portable installation from a ZIP.

Note: not a duplicate of #549, this is a bug with the PATH not getting modified when it should be.

Steps to reproduce

Checkout https://github.com/microsoft/winget-pkgs/pull/285465

C:\winget-pkgs>winget install --manifest manifests\x\x64dbg\x64dbg\2025.08.19
Found x64dbg [x64dbg.x64dbg] Version 2025.08.19
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Extracting archive...
Successfully extracted archive
Starting package install...
Path environment variable modified; restart your shell to use the new value.
Command line alias added: "x96dbg"
Command line alias added: "x32dbg"
Command line alias added: "x64dbg"
Successfully installed

Restart cmd.exe from explorer:

C:\CodeBlocks\winget-pkgs>where x64dbg
INFO: Could not find files for the given pattern(s).

C:\CodeBlocks\winget-pkgs>where x32dbg
INFO: Could not find files for the given pattern(s).

The package is installed correctly in C:\Users\Admin\AppData\Local\Microsoft\WinGet\Packages\x64dbg.x64dbg__DefaultSource\release\x64\x64dbg.exe, so it is the PATH modification logic that fails

Expected behavior

I would expect the PATH to get modified to include the following folders:

  • C:\Users\Admin\AppData\Local\Microsoft\WinGet\Packages\x64dbg.x64dbg__DefaultSource\release
  • C:\Users\Admin\AppData\Local\Microsoft\WinGet\Packages\x64dbg.x64dbg__DefaultSource\release\x64
  • C:\Users\Admin\AppData\Local\Microsoft\WinGet\Packages\x64dbg.x64dbg__DefaultSource\release\x32

It works fine with the yt-dlp package:

C:\CodeBlocks\winget-pkgs>winget install --manifest manifests\y\yt-dlp\yt-dlp\2025.08.11
Found yt-dlp [yt-dlp.yt-dlp] Version 2025.08.11
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
This package requires the following dependencies:
  - Packages
      yt-dlp.FFmpeg
(1/1) Found FFmpeg for yt-dlp [yt-dlp.FFmpeg] Version N-120424-g03b9180fe3-20250731
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/yt-dlp/FFmpeg-Builds/releases/download/autobuild-2025-07-31-15-41/ffmpeg-N-120424-g03b9180fe3-win64-gpl.zip
  ██████████████████████████████   147 MB /  147 MB
Successfully verified installer hash
Extracting archive...
Successfully extracted archive
Starting package install...
Path environment variable modified; restart your shell to use the new value.
Command line alias added: "ffmpeg"
Command line alias added: "ffplay"
Command line alias added: "ffprobe"
Successfully installed

Downloading https://github.com/yt-dlp/yt-dlp/releases/download/2025.08.11/yt-dlp.exe
  ██████████████████████████████  17.5 MB / 17.5 MB
Successfully verified installer hash
Starting package install...
Command line alias added: "yt-dlp"
Path environment variable modified; restart your shell to use the new value.
Successfully installed

C:\CodeBlocks\winget-pkgs>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..

C:\CodeBlocks\winget-pkgs>where yt-dlp
C:\Users\Admin\AppData\Local\Microsoft\WinGet\Links\yt-dlp.exe

C:\CodeBlocks\winget-pkgs>

Actual behavior

The PATH is not modified to include any of these folders

Environment

C:\Users\Admin>winget --info
Windows Package Manager v1.11.430
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.19045.6216
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.26.430.0

Winget Directories
-----------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Diag…
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\sett…
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads
Configuration Modules              %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Enabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled

mrexodia avatar Aug 21 '25 14:08 mrexodia

For completeness sake, here are the actual yaml files that reproduce this (I might change the branch):

x64dbg.x64dbg.installer.yaml:

# Created with komac v2.10.1
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.10.0.schema.json

PackageIdentifier: x64dbg.x64dbg
PackageVersion: 2025.08.19
InstallerType: zip
NestedInstallerType: portable
ArchiveBinariesDependOnPath: true
InstallModes:
  - interactive
  - silent
  - silentWithProgress
UpgradeBehavior: install
Commands:
  - x96dbg
  - x32dbg
  - x64dbg
ReleaseDate: 2025-08-19
Installers:
  - Architecture: x86
    InstallerUrl: https://github.com/x64dbg/x64dbg/releases/download/2025.08.19/snapshot_2025-08-19_19-40.zip
    InstallerSha256: CC614CAF34F9FE1EC156F045129DB3A513C35593FF1EE647BC819A352DC12271
    NestedInstallerFiles:
      - RelativeFilePath: release\x96dbg.exe
        PortableCommandAlias: x96dbg
      - RelativeFilePath: release\x32\x32dbg.exe
        PortableCommandAlias: x32dbg
  - Architecture: x64
    InstallerUrl: https://github.com/x64dbg/x64dbg/releases/download/2025.08.19/snapshot_2025-08-19_19-40.zip
    InstallerSha256: CC614CAF34F9FE1EC156F045129DB3A513C35593FF1EE647BC819A352DC12271
    NestedInstallerFiles:
      - RelativeFilePath: release\x96dbg.exe
        PortableCommandAlias: x96dbg
      - RelativeFilePath: release\x32\x32dbg.exe
        PortableCommandAlias: x32dbg
      - RelativeFilePath: release\x64\x64dbg.exe
        PortableCommandAlias: x64dbg
ManifestType: installer
ManifestVersion: 1.10.0

x64dbg.x64dbg.locale.en-US.yaml:

# Created with komac v2.10.1
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.10.0.schema.json

PackageIdentifier: x64dbg.x64dbg
PackageVersion: 2025.08.19
PackageLocale: en-US
Publisher: x64dbg
PublisherUrl: https://github.com/x64dbg
PublisherSupportUrl: https://github.com/x64dbg/x64dbg/issues
PackageName: x64dbg
PackageUrl: https://github.com/x64dbg/x64dbg
License: GPL-3.0 (Modified)
LicenseUrl: https://github.com/x64dbg/x64dbg/blob/development/LICENSE
ShortDescription: An open-source user mode debugger for Windows. Optimized for reverse engineering and malware analysis.
Description: An open-source binary debugger for Windows, aimed at malware analysis and reverse engineering of executables you do not have the source code for.
ReleaseNotesUrl: https://github.com/x64dbg/x64dbg/releases/tag/2025.08.19
ManifestType: defaultLocale
ManifestVersion: 1.10.0

x64dbg.x64dbg.yaml:

# Created with komac v2.10.1
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.10.0.schema.json

PackageIdentifier: x64dbg.x64dbg
PackageVersion: 2025.08.19
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.10.0

mrexodia avatar Aug 21 '25 14:08 mrexodia

Package that also does not work: winget install --manifest manifests\u\UPX\UPX\4.0.1

mrexodia avatar Aug 21 '25 14:08 mrexodia

Setting ArchiveBinariesDependOnPath: false 'works' in the sense that C:\Users\Admin\AppData\Local\Microsoft\WinGet\Links\x64dbg.exe is on the PATH, but the application does not work correctly.

mrexodia avatar Aug 21 '25 14:08 mrexodia

Maybe https://stackoverflow.com/questions/34491244/environment-variable-is-too-large-on-windows-10

soredake avatar Nov 06 '25 08:11 soredake

@soredake not relevant, because the PATH is edited correctly in other cases.

mrexodia avatar Nov 06 '25 13:11 mrexodia