ScoopInstaller / Scoop

A command-line installer for Windows.
https://scoop.sh
Other
20.85k stars 1.39k forks source link

[Bug] Scoop inside Docker container doesn't work anymore #6071

Closed maherm closed 1 month ago

maherm commented 1 month ago

Bug Report

Since we are not on Github with our internal bucket, we can not use Github Actions. So we use the Excavator Docker container for autoupdating out internal bucket. This used to work flawlessly until recently.

Current Behavior

When run inside a docker container, scoop is not finding the downloaded files anymore:

main-1   | Autoupdating internal-app
main-1   | Downloading artifact.zip to compute hashes!                                                                                        
main-1   | Downloading https://repo.internal/internal-app-3.4.99.98.zip (10.6 MB)...
main-1   | Move-Item: /root/scoop/lib/install.ps1:90
main-1   | Line |
main-1   |   90 |          Move-Item "$cached.download" $cached -Force                                                                                 
main-1   |      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                                                 
main-1   |      | Cannot find path                                                                                                                     
main-1   |      | '/root/cache/internal-app#3.4.99.98#1de3e3a.zip.download' because                                                             
main-1   |      | it does not exist.
main-1   | Get-FileHash: /root/scoop/lib/autoupdate.ps1:300                                                                                            
main-1   | Line |                                                                                                                                      
main-1   |  300 |      $hash = (Get-FileHash -Path $file -Algorithm SHA256).Hash.ToLower …                                                             
main-1   |      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main-1   |      | Cannot find path '/root/cache/internal-app#3.4.99.98#1de3e3a.zip'                                                             
main-1   |      | because it does not exist.                                                                                                           
main-1   | Exception: /root/scoop/lib/autoupdate.ps1:466                                                                                               
main-1   | Line |
main-1   |  466 |  … asChanged = Update-ManifestProperty -Manifest $Manifest -Property $up …                                                           
main-1   |      |                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                             
main-1   |      | You cannot call a method on a null-valued expression. 

Expected Behavior

No Exception.

Additional context/output

It looks like the file path is constructed wrong when downloading the file. Note the backslash in the cached filenames.

# ls -l /root
total 13280
drwxr-xr-x 8 root root     4096 Jul 22 09:57  bucket
drw-rw-rw- 1 root root     4096 Jul 22 09:56  cache
-rw-r--r-- 1 root root     5417 Jul 22 11:02 'cache\internal-app1#3.2.2#6c33306.zip.download'
-rw-r--r-- 1 root root 11092955 Jul 23 08:20 'cache\internal-app2#3.4.99.98#1de3e3a.zip.download'
-rw-r--r-- 1 root root  2466339 Jul 22 11:35 'cache\internal-app3#3.44.1.0#8b7e377.zip.download'
-rwxr-xr-x 1 root root     1867 May 25  2023  excavate.sh
-rw-r--r-- 1 root root        0 Jul 22 09:57  first_run
drwxr-xr-x 2 root root     4096 Jul 22 09:56  log
drwxr-xr-x 1 root root     4096 Jul 22 11:29  scoop
# 

Possible Solution

System details

The Dockerfile is the one from the Excavator repo

Windows version: irrelevant (same beaviour on Windows 11 as well as CentOS) The Docker image uses the phocal baseimage with Ubuntu 20.04.3 LTS

OS architecture: 64bit

PowerShell version: 7.4.3

Additional software: Docker version 20.10.10, build b485636 on CentOS Docker version 26.1.4, build 5650f9b on Windows

Scoop Configuration

maherm commented 1 month ago

It seems the bug was introduced in #5836. Checking out and using Scoop on commit 77b66cc (parent of the one #5836 was merged in) works