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

ci: Fix SDK test script unbound variable error #1128

Merged
merged 1 commit into from
Oct 15, 2020

Conversation

Ali-Piccioni
Copy link
Contributor

@Ali-Piccioni Ali-Piccioni commented Oct 15, 2020

ci: Fix SDK test script unbound variable error

The problem with the original script is that we set set -u at the top which treats unset variables as errors.
This causes an error when evaluating "$DFX_VER" inside the if statement, because DFX_VER is unset.

${var+x} is a parameter expansion which evaluates to nothing if var is unset, and substitutes the string x otherwise.
https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash

Copy link

@luc-mercier luc-mercier left a comment

Choose a reason for hiding this comment

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

Can you enlighten me? I don't know what "+x" means.

@Ali-Piccioni
Copy link
Contributor Author

Can you enlighten me? I don't know what "+x" means.

@luc-mercier

The problem with the original script is that we set set -u at the top which treats unset variables as errors.
This causes an error when evaluating "$DFX_VER" inside the if statement, because DFX_VER is unset.

${var+x} is a parameter expansion which evaluates to nothing if var is unset, and substitutes the string x otherwise.

https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash

@luc-mercier
Copy link

Can you enlighten me? I don't know what "+x" means.

@luc-mercier

The problem with the original script is that we set set -u at the top which treats unset variables as errors.
This causes an error when evaluating "$DFX_VER" inside the if statement, because DFX_VER is unset.

${var+x} is a parameter expansion which evaluates to nothing if var is unset, and substitutes the string x otherwise.

https://stackoverflow.com/questions/3601515/how-to-check-if-a-variable-is-set-in-bash

Thanks for the explanation! Makes sense. I copied it to the PR description: those types of essential explanations belong to the PR descriptions more than they do to the comment thread.

@mergify mergify bot merged commit ab529dd into master Oct 15, 2020
@mergify mergify bot deleted the ci/ali=fix-sdk-test-script branch October 15, 2020 12:13
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

Successfully merging this pull request may close these issues.

2 participants