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

[Bug]: yt-dlp removed from PATH after updating it with WAU #542

Closed
soredake opened this issue Dec 27, 2023 · 7 comments
Closed

[Bug]: yt-dlp removed from PATH after updating it with WAU #542

soredake opened this issue Dec 27, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@soredake
Copy link

soredake commented Dec 27, 2023

The problem

After updating yt-dlp with WAU package path it's no longer present in PATH.

How to reproduce this bug in clean updated vm:

winget install -h -e --id yt-dlp.yt-dlp -v 2023.10.07
Invoke-WebRequest -Uri "https://github.com/Romanitho/Winget-AutoUpdate/archive/refs/heads/main.zip" -OutFile "$HOME/Downloads/Winget-AutoUpdate.zip"
Expand-Archive "$HOME/Downloads/Winget-AutoUpdate.zip" -DestinationPath "$HOME/Downloads"
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Start-Process powershell -Verb runAs -ArgumentList '~\Downloads\Winget-AutoUpdate-main\Sources\WAU\Winget-AutoUpdate-Install.ps1 -StartMenuShortcut -Silent -InstallUserContext -NotificationLevel None -UpdatesInterval Weekly -DoNotUpdate -UpdatesAtTime 11AM'
C:\Windows\system32\wscript.exe "C:\ProgramData\Winget-AutoUpdate\Invisible.vbs" "powershell.exe -NoProfile -ExecutionPolicy Bypass -File """C:\ProgramData\Winget-AutoUpdate\user-run.ps1""

What version of WAU has the issue?

1.19.2-1

What version of Windows are you using (ex. Windows 11 22H2)?

Windows 11 23H2

What version of winget are you using?

v1.7.3481-preview

Log information

################################################################
#     12/27/2023 - CHECK FOR APP UPDATES (User context)
################################################################
15:56:26 - Notification Level: None. Notification Language: English
15:56:26 - Checking internet connection...
15:56:26 - Connected !
15:56:27 - Winget Version: v1.7.3481-preview
15:56:27 - WAU current version: 1.19.2-1
15:56:27 - WAU uses Black List config
15:56:27 - Checking application updates on Winget Repository...
-> Available update : yt-dlp. Current version : 2023.10.07. Available version : 2023.10.13.
15:56:31 - Updating yt-dlp from 2023.10.07 to 2023.10.13...
15:56:31 - ##########   WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID 'yt-dlp.yt-dlp'   ##########
15:56:31 - -> Running: Winget upgrade --id yt-dlp.yt-dlp -e --accept-package-agreements --accept-source-agreements -s winget -h


Found yt-dlp [yt-dlp.yt-dlp] Version 2023.10.13
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
(1/1) Found FFmpeg [Gyan.FFmpeg] Version 6.1
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
15:57:05 - -> An upgrade for yt-dlp failed, now trying an install instead... (1/2)
15:57:05 - -> Running: Winget install --id yt-dlp.yt-dlp -e --accept-package-agreements --accept-source-agreements -s winget -h --force

Found yt-dlp [yt-dlp.yt-dlp] Version 2023.10.13
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
(1/1) Found FFmpeg [Gyan.FFmpeg] Version 6.1
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: "ffmpeg"
Command line alias added: "ffplay"
Command line alias added: "ffprobe"
Successfully installed

Downloading https://github.com/yt-dlp/yt-dlp/releases/download/2023.10.13/yt-dlp.exe


  ██▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 13.2 MB
  ███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 13.2 MB
  ████████████████████▒▒▒▒▒▒▒▒▒▒  9.00 MB / 13.2 MB
  ██████████████████████████████  13.2 MB / 13.2 MB
  ██████████████████████████████  13.2 MB / 13.2 MB
Successfully verified installer hash
Starting package install...
Command line alias added: "yt-dlp"
Successfully installed
15:57:29 - ##########   WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID 'yt-dlp.yt-dlp'   ##########
15:57:29 - yt-dlp updated to 2023.10.13 !
15:57:29 - 1 apps updated ! No more update.
15:57:29 - End of process!

Additional information

No response

@soredake soredake added the bug Something isn't working label Dec 27, 2023
@soredake
Copy link
Author

soredake commented Jan 8, 2024

Same problem with these packages (probably all portable packages are affected): Gyan.FFmpeg lycheeverse.lychee

@AndrewDemski-ad-gmail-com
Copy link
Contributor

AndrewDemski-ad-gmail-com commented Jan 8, 2024

According to information provided by manufacturer of that product, winget should register command alias for the tool, not modify the path.
https://github.com/microsoft/winget-pkgs/blob/ddf059befd5e72a070dbb0f0aa3188642e24d1e7/manifests/y/yt-dlp/yt-dlp/2023.12.30/yt-dlp.yt-dlp.installer.yaml#L7

That is seen in the log provided:

Starting package install...
Command line alias added: "yt-dlp"
Successfully installed

Even manufacturer suggested ~8 months ago to add it manually to $PATH
https://github.com/yt-dlp/yt-dlp-wiki/blob/3a5dc600e1d05009928356c2f7bb637b266f30c9/Windows.md#for-long-term-use

According to evidence provided it works as designed.

@soredake
Copy link
Author

soredake commented Jan 8, 2024

According to information provided by manufacturer of that product, winget should register command alias for the tool, not modify the path.

If you install without admin rights in user scope it will modify the PATH, if you install with admin rights in user scope it will create an alias. microsoft/winget-cli#4009 (comment)

Even manufacturer suggested ~8 months ago to add it manually to $PATH

This info is outdated.

@AndrewDemski-ad-gmail-com
Copy link
Contributor

AndrewDemski-ad-gmail-com commented Jan 8, 2024

I see..
You are absolutely right.

In this respect, there have been some attempts to improve winget in this regard

Direct quote from authors:

// If we fail to create a symlink, add install directory to PATH variable

https://github.com/microsoft/winget-cli/blob/96a7f678c38becd62e150199ecd1e9080f2622cc/src/AppInstallerCLICore/PortableInstaller.h#L35

Apparently some fix was added to solve the issue: microsoft/winget-cli#3002
Yet it still remains open: microsoft/winget-cli#549

Question remains open: if it is a "logic flaw" of winget itself, then how is that related to WAU?

The only solution which comes to my mind is adding post-install action(s) to suplement the installation workflow with desired configuration.
.. but that would have to be treated as patch for every identified product.

Update
There is a way: https://learn.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links
but it could be a beginning of a long discussion about security in every company which would ever use winget.
Yes, that is a funny statement since winget already come with W11 :)

@soredake
Copy link
Author

soredake commented Jan 8, 2024

Yet it still remains open: microsoft/winget-cli#549

This issue is more about broken installers that do not modify path (like 7zip/7zip-zstd/vim/llvm/proxinject/etc) when they should.

then how is that related to WAU?

It is related to WAU, it does not happen when I just use winget upgrade, and upgrade is failing in WAU which is not the case with plain winget upgrade:
image

@KnifMelti
Copy link
Contributor

KnifMelti commented Jan 8, 2024

It is related to WAU, it does not happen when I just use winget upgrade, and upgrade is failing in WAU which is not the case with plain winget upgrade:
image

That's when WAU tries winget upgrade, after that it tries winget install and it then gets upgraded.

@soredake
Copy link
Author

soredake commented Jan 8, 2024

I retested this in vm again, and now it happens even without WAU, will report to winget repo then.

@soredake soredake closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants