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

git effort bad substitution error #1002

Closed
ifduyue opened this issue Oct 19, 2022 · 12 comments
Closed

git effort bad substitution error #1002

ifduyue opened this issue Oct 19, 2022 · 12 comments

Comments

@ifduyue
Copy link

ifduyue commented Oct 19, 2022

Hello,

/opt/homebrew/bin/git-effort: line 272:  ${nJobs@P} >= nProcs : bad substitution

related code:

# send paths to effort
nPaths=${#paths[@]}
nProcs=$(procs)
nJobs="\j"
for ((i=0; i<nPaths; ++i))
do
    while (( ${nJobs@P} >= nProcs )); do
        wait -n
    done
    effort "${paths[i]}" &
done|tee $tmp

What does nJobs="\j" mean?

@spacewander
Copy link
Collaborator

It's Bash's PROMPTING syntax. For example, \H means "the hostname", \j means "the number of jobs currently managed by the shell". You can find them in man bash.

What shell are you using?

@zijie0
Copy link

zijie0 commented Oct 20, 2022

I also met this issue on Mac using zsh.

@ifduyue
Copy link
Author

ifduyue commented Oct 20, 2022

On macOS using zsh.

@zijie0
Copy link

zijie0 commented Oct 20, 2022

Revert to 6.4.0 solve the issue.

@spacewander
Copy link
Collaborator

Interesting, this command is expected to be executed under bash:

#!/usr/bin/env bash

What is the /usr/bin/env bash --version output in your machine?

@zijie0
Copy link

zijie0 commented Oct 21, 2022

/usr/bin/env bash --version
GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)
Copyright (C) 2007 Free Software Foundation, Inc.

I also tried switching to bash:

bash

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
bash-3.2$ echo $SHELL
/bin/zsh

I think there's some setting need to be modified on Mac?

@ifduyue
Copy link
Author

ifduyue commented Oct 22, 2022

Maybe another way to achieve the same purpose? How about jobs -r | wc -l?

@ifduyue
Copy link
Author

ifduyue commented Oct 22, 2022

After brew install bash git-effort works again.

@spacewander
Copy link
Collaborator

Maybe another way to achieve the same purpose? How about jobs -r | wc -l?

Pull request is welcome!

spacewander added a commit to spacewander/homebrew-core that referenced this issue Oct 30, 2022
@spacewander
Copy link
Collaborator

@ifduyue @zijie0
Here is an interesting question: as we have #!/usr/bin/env bash in every script, why zsh is used instead?

@ifduyue
Copy link
Author

ifduyue commented Nov 1, 2022

@spacewander Mac OS bundled /bin/bash version is GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21), it's too low that it doesn't support ${parameter@P}.

@ifduyue ifduyue closed this as completed Nov 1, 2022
@chipweinberger
Copy link

chipweinberger commented Feb 8, 2023

I'm getting this error too!

M1 MBP.

git version 2.32.0 (Apple Git-132)

git extras -v
6.5.0

MacOS 12.6.3

Edit, yes after brew install bash git-effort works again.

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

No branches or pull requests

4 participants