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] Errors on scoop alias list when config.json is empty #4652

Closed
rashil2000 opened this issue Jan 12, 2022 · 1 comment
Closed

[Bug] Errors on scoop alias list when config.json is empty #4652

rashil2000 opened this issue Jan 12, 2022 · 1 comment
Labels

Comments

@rashil2000
Copy link
Member

Bug Report

Current Behavior

When the aliases property of config.json is empty, the command scoop alias list throws a ton of errors.

Expected Behavior

It should show no output at all.

Additional context/output

Click to see stacktrace
~                                                                                            in [pwsh] at •100% 23:45:23
❯ scoop alias list
Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
  22 |          $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
     |                    ~~~~~~~~~~~~~~~~~~~~~~
     | Cannot find path 'C:\Users\username\scoop\shims\scoop-IsReadOnly.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-IsReadOnly.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-IsFixedSize.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-IsFixedSize.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-IsSynchronized.ps1' because it does not
| exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-IsSynchronized.ps1' because it does not
| exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Keys.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Keys.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Values.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Values.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-SyncRoot.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-SyncRoot.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Get-Content: C:\Users\username\scoop\apps\scoop\current\lib\commands.ps1:22
Line |
22 | $line = ((Get-Content $shim_path) | Where-Object { $_.startsw …
| ~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Count.ps1' because it does not exist.

Get-Content: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:91
Line |
91 | $content = Get-Content (command_path $_.Name)
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path 'C:\Users\username\scoop\shims\scoop-Count.ps1' because it does not exist.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:92
Line |
92 | $command = ($content | Select-Object -Skip 1).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

InvalidOperation: C:\Users\username\scoop\apps\scoop\current\libexec\scoop-alias.ps1:93
Line |
93 | $summary = (summary $content).Trim()
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.

Count
IsFixedSize
IsReadOnly
IsSynchronized
Keys
SyncRoot
Values

Possible Solution

The aliases it's looking for are the properties of a PowerShell object itself. Can be remedied by properly checking if aliases filed exists in the config.json file.

System details

Windows version: 10

OS architecture: 64bit

PowerShell version: Both 5.1 and 7.2.0

Additional software: None

Scoop Configuration

{
    "lastupdate": "2022-01-12T13:54:11.0126966+05:30",
    "SCOOP_REPO": "https://github.com/lukesampson/scoop",
    "SCOOP_BRANCH": "develop",
    "aria2-enabled": false,
    "shim": "kiennq",
    "manifest-review": true
}
@rashil2000 rashil2000 added the bug label Jan 12, 2022
@rashil2000
Copy link
Member Author

Oops, my bad

#3528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant