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

fix(install): Skip the 0th arg as it is the script name #659

Closed
wants to merge 1 commit into from

Conversation

BYK
Copy link
Member

@BYK BYK commented Sep 4, 2020

Fixes #656.

@BYK
Copy link
Member Author

BYK commented Sep 4, 2020

/cc @ktosiek as this was introduced in #615.

@BYK BYK requested a review from joshuarli September 4, 2020 20:29
@@ -24,7 +24,7 @@ SENTRY_EXTRA_REQUIREMENTS='sentry/requirements.txt'
MINIMIZE_DOWNTIME=

load_options() {
while [[ -n "$@" ]]; do
while [[ -n "${@:1}" ]]; do
Copy link
Member

@joshuarli joshuarli Sep 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

${@:1} is kind of a special case of bash-specific substring expansion ${parameter:offset} where bash arrays are treated specially, I had to look this up myself. I'd suggest this to make it more readable, your choice though.

Suggested change
while [[ -n "${@:1}" ]]; do
shift # throw away $0
while [[ -n "$@" ]]; do

@ktosiek
Copy link
Contributor

ktosiek commented Sep 5, 2020

The problem seems to actually be with getopt - I've assumed GNU getopt, and MacOS uses a simpler BSD getopt. I'll prepare a patch removing the getopt call - there's only one short option anyway, and it should make the code simpler.

It's not a problem with "$@" - bash manual says "$@ Expands to the positional parameters, starting from one." https://www.gnu.org/software/bash/manual/bash.html#index-_0040 - which means getopt shouldn't get the $0, and shouldn't pass it to load_options.

Edit: fixed in #660.

BYK pushed a commit that referenced this pull request Sep 7, 2020
The code assumed GNU getopt, which is not the default on many platforms, notably OSX.

Fixes #656, and replaces #659.
@BYK
Copy link
Member Author

BYK commented Sep 7, 2020

Closing in favor of #660

@BYK BYK closed this Sep 7, 2020
@joshuarli joshuarli deleted the byk/fix/install-first-arg branch September 7, 2020 18:44
@github-actions github-actions bot locked and limited conversation to collaborators Dec 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

I couldn't run ./install.sh on Mac but could run ./test.sh
4 participants