ScoopInstaller / Scoop

A command-line installer for Windows.

Home Page:https://scoop.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] `checkver.ps1` wrongly shows `URL not valid` when disconnected

goyalyashpal opened this issue · comments

Bug Report

Current Behavior

when the system is not connected to internet, the scoop/bin/checkver.ps1 says URL ... is not valid

Expected Behavior

it should have said disconnected, or not connected, or unable to connect or the like.
but never "URL invalid" in such case

Additional context/output

$ declare spf="/d/userfiles/scoop/apps/scoop/current/bin"

$ # Disconnected state
$ ls *.json | sed 's/.json$//' | xargs -i powershell -c $spf/checkver.ps1 {} .
beeref: The remote name could not be resolved: 'api.github.com'
URL https://api.github.com/repos/rbreu/beeref/releases/latest is not valid
doublecmd-devrelease: The remote name could not be resolved: 'api.github.com'
URL https://api.github.com/repos/doublecmd/doublecmd/releases/latest is not valid
doublecmd-snapshot: The remote name could not be resolved: 'doublecmd.sourceforge.io'
URL https://doublecmd.sourceforge.io/snapshots/rss.php?os=win is not valid

$ # Connected
$ ls *.json | sed 's/.json$//' | xargs -i powershell -c $spf/checkver.ps1 {} .
beeref: 0.3.2
doublecmd-devrelease: 1.1.12
doublecmd-snapshot: 1.2.0.r11292 (scoop version is 1.2.0.r11286) autoupdate available

Possible Solution

shared in first comment below to keep it separate

System details

$ systeminfo | grep -iE "^os version|system type"
OS Version:                10.0.19045 N/A Build 19045
System Type:               x64-based PC

$ powershell -c '& {$PSVersionTable.PSVersion}'

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  4170

$ cat "$USERPROFILE"/.config/scoop/config.json
{
    "root_path":  "D:\\UserFiles\\scoop",
    "global_path":  "D:\\ProgramFiles\\scoop_global",
    "last_update":  "2024-04-13T08:17:11.8296437......",
    "alias":  {
                  "cat-dum":  "scoop-cat-dum"
              },
    "debug":  true,
    "scoop_branch":  "master",
    "scoop_repo":  "https://github.com/ScoopInstaller/Scoop"
}

$ scoop -V | head -n2
Current Scoop version:
v0.3.1 - Released at 2022-11-15

Possible Solution

i understand that the condition / trigger for showing invalid url might very well be valid, or a more aware check might be hard to implement.

so, a check should be made before actually using the url to ensure if connected to internet. if not, then it should gracefully exit right there and skip using / commenting on url altogether.

but the problem with this can be that it won't work with local urls/full filenames.