marticliment / UniGetUI

UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers
https://www.marticliment.com/unigetui/
MIT License
10.4k stars 338 forks source link

[ENHANCEMENT] Permanently/temporarily disable aria2c for Scoop #1723

Open redactedscribe opened 5 months ago

redactedscribe commented 5 months ago

Please confirm these before moving forward

Describe the improvement

Sometimes Scoop updates fail when trying to download them because of an aria2c error. WingetUI uses aria2c for Scoop updates by default and I don't think can be disabled (via the UI at least). I have encountered the same issue using aria2c quite a few times in the past (before using WingetUI), enough times that I decided to disable aria2c (which isn't enabled by default for Scoop).

In this particular case, I could not update emacs via WingetUI because of aria2c. Here is essentially the same output I saw in WingetUI but from running scoop update emacs manually:

14:09 ❯ scoop update emacs
emacs: 29.1 -> 29.2
WARN  Scoop uses 'aria2c' for multi-connection downloads.
WARN  Should it cause issues, run 'scoop config aria2-enabled false' to disable it.
WARN  To disable this warning, run 'scoop config aria2-warning-enabled false'.
Updating one outdated app:
Updating 'emacs' (29.1 -> 29.2)
Downloading new version
Starting download with aria2 ...
Download: 01/20 14:09:58 [ERROR] CUID#8 - Download aborted. URI=https://ftpmirror.gnu.org/gnu/emacs/windows/emacs-29/emaDownload: Exception: [AbstractCommand.cc:351] errorCode=1 URI=https://gnuftp.uib.no/emacs/windows/emacs-29/emacs-29.2.ziDownload:   -> [SocketCore.cc:1019] errorCode=1 SSL/TLS handshake failure: Error: The revocation function was unable to Download: Download Results:
Download: gid   |stat|avg speed  |path/URI
Download: ======+====+===========+=======================================================
Download: 5e27ad|ERR |       0B/s|D:/!_scoop/cache/emacs#29.2#https_ftpmirror.gnu.org_gnu_emacs_windows_emacs-29_emacs-29.2.zip
Download: Status Legend:
Download: (ERR):error occurred.
Download: aria2 will resume download if the transfer is restarted.
Download: If there are any errors, then see the log file. See '-l' option in help/man page for details.

ERROR Download failed! (Error 1) An unknown error occurred
ERROR https://ftpmirror.gnu.org/gnu/emacs/windows/emacs-29/emacs-29.2.zip
    referer=https://ftpmirror.gnu.org/gnu/emacs/windows/emacs-29/
    dir=D:\Scoop\cache
    out=emacs#29.2#https_ftpmirror.gnu.org_gnu_emacs_windows_emacs-29_emacs-29.2.zip

ERROR & 'D:\Scoop\apps\aria2\current\aria2c.exe' --input-file='D:\Scoop\cache\emacs.txt' --user-agent='Scoop/1.0 (+http://scoop.sh/) PowerShell/7.4 (Windows NT 10.0; Win64; x64; Core)' --allow-overwrite=true --auto-file-renaming=false --retry-wait=2 --split=5 --max-connection-per-server=5 --min-split-size=5M --console-log-level=warn --enable-color=false --no-conf=true --follow-metalink=true --metalink-preferred-protocol=https --min-tls-version=TLSv1.2 --stop-with-process=27400 --continue --summary-interval=0 --auto-save-interval=1

Please try again or create a new issue by using the following link and paste your console output:
https://github.com/ScoopInstaller/Extras/issues/new?title=emacs%4029.2%3a+download+via+aria2+failed

Then after disabling aria2c for Scoop (scoop config aria2-enabled false), scoop update emacs:

Updating one outdated app:
Updating 'emacs' (29.1 -> 29.2)
Downloading new version
emacs-29.2.zip (150.4 MB) [===================================================================================] 100%
Checking hash of emacs-29.2.zip ... ok.
Uninstalling 'emacs' (29.1)
Removing shim 'runemacs.shim'.
Removing shim 'runemacs.exe'.
Removing shim 'emacs.shim'.
Removing shim 'emacs.exe'.
Removing shim 'emacsclientw.shim'.
Removing shim 'emacsclientw.exe'.
Removing shim 'etags.shim'.
Removing shim 'etags.exe'.
Removing shim 'ctags.shim'.
Removing shim 'ctags.exe'.
Unlinking D:\Scoop\apps\emacs\current
Installing 'emacs' (29.2) [64bit] from extras bucket
Loading emacs-29.2.zip from cache
Extracting emacs-29.2.zip ... done.
Linking D:\Scoop\apps\emacs\current => D:\Scoop\apps\emacs\29.2
Creating shim for 'runemacs'.
Creating shim for 'emacs'.
Creating shim for 'emacsclientw'.
Creating shim for 'etags'.
Creating shim for 'ctags'.
Creating shortcut for Emacs (runemacs.exe)
Creating shortcut for Emacs Client (emacsclientw.exe)
'emacs' (29.2) was installed successfully!
Notes
-----
For 32-bit version, install 'versions/emacs27.2'

For this reason, I'd like a way to enable/disable using aria2c for all Scoop updates via WingetUI's preferences. Also, for updates which have Scoop as their source, and when aria2c is enabled, the right-click content menu could have an additional menu entry: "Update (without aria2c)", or similar.

Describe how this improvement could help users.

No need to resort back to the CLI to work around these aria2c download/update issues.

List of Scoop packages I've found to fail to update when aria2c is enabled

redactedscribe commented 5 months ago

I was under the wrong impression when writing this issue: I don't think WingetUI uses aria2c for downloading by default. It is only being used because I had enabled it for Scoop itself. Disabling it for Scoop causes the update to succeed using WingetUI. Therefore download errors using aria2c are unrelated to WingetUI, however it still remains that it would be convenient to be able to toggle using aria2c or not via WingetUI itself.

All that should be needed is reading the returned value of scoop config aria2-enabled and then setting the opposite e.g. scoop config aria2-enabled false before initialising the update. It can be immediately set back after the update begins I believe so that the next Scoop package uses aria2c again.

redactedscribe commented 3 weeks ago

I have decided to disable aria2c since this issue occurs too regularly for me. I will see how it goes, but implementation of this temporary toggle shouldn't be too much of a challenge:

I previously suggested:

the right-click content menu could have an additional menu entry: "Update (without aria2c)", or similar.

Better would be a checkbox option to temporarily disable downloading using aria2c via the Installation options popup. This option only need be visible if scoop config aria2-enabled returns true (because it might be set via the command line rather than any UI toggle which you provide).

  1. User checks the hypothetical checkbox.
  2. User presses Install.
  3. Set scoop config aria2-enabled to false.
  4. UniGetUI runs the usual command to install the given package.
  5. Since the command is now running, scoop config aria2-enabled can be immediately set back to true for the next download. It doesn't need to wait until the download has been completed. This way if the download is cancelled, scoop config aria2-enabled won't remain false by mistake.

If the user wants to disable aria2c (not temporarily), you could offer a toggle via UniGetUI's preferences for Scoop.

Thanks.