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] '*' not escaped correctly from git bash #4808

Closed
e6c31d opened this issue Mar 13, 2022 · 0 comments · Fixed by #4809 or #4896
Closed

[Bug] '*' not escaped correctly from git bash #4808

e6c31d opened this issue Mar 13, 2022 · 0 comments · Fixed by #4809 or #4896
Labels

Comments

@e6c31d
Copy link
Contributor

e6c31d commented Mar 13, 2022

Bug Report

When running scoop from git bash, using '*' (for example: scoop update '*') expands to all files in the current directory, even though it's quoted correctly. I'm certain this used to work correctly the last time I tried it a few months ago.

Current Behavior

Running in git bash:

$ scoop update '*'
ERROR '3D' isn't installed.
ERROR 'AppData' isn't installed.
ERROR 'Application' isn't installed.
ERROR 'Contacts' isn't installed.
ERROR 'Cookies' isn't installed.
ERROR 'Desktop' isn't installed.
ERROR 'Documents' isn't installed.
ERROR 'Downloads' isn't installed.
...

Expected Behavior

Running scoop update '*' from git bash updates all out of date applications.

Additional context/output

I tracked it down to ~/scoop/shims/scoop shell script, which currently uses $@ instead of "$@" to pass all arguments to powershell. This sh->ps1 shim seems to be written from here:

Scoop/lib/core.ps1

Lines 689 to 695 in 7d5a47c

"#!/bin/sh",
"# $resolved_path",
"if command -v pwsh.exe > /dev/null 2>&1; then",
" pwsh.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@",
"else",
" powershell.exe -noprofile -ex unrestricted -file `"$resolved_path`" $arg $@",
"fi"

The other sh shims in lib/core.ps1 (sh->cmd/bat/jar/py/...) all use "$@", so I believe it was omitted unintentionally.

Possible Solution

Fix the quoting of $@ in the above lines in lib/core.ps1

System details

Windows version: 10

OS architecture: 64bit

PowerShell version:

PS> $PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  1320

Additional software:

$ git --version
git version 2.35.1.windows.2
$ bash --version
GNU bash, version 4.4.23(2)-release (x86_64-pc-msys)

Scoop Configuration

{
    "lastupdate":  "2022-03-13T07:24:36.8369155+03:00",
    "SCOOP_REPO":  "https://github.com/lukesampson/scoop",
    "SCOOP_BRANCH":  "master",
    "alias":  {

              }
}
@e6c31d e6c31d added the bug label Mar 13, 2022
@e6c31d e6c31d changed the title [Bug] [Bug] '*' not escape correctly from git bash Mar 13, 2022
@e6c31d e6c31d changed the title [Bug] '*' not escape correctly from git bash [Bug] '*' not escaped correctly from git bash Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant