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

Handle dashes in flag names #188

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

mblayman
Copy link

@mblayman mblayman commented Feb 21, 2024

This change adds a guard to a flag to ensure that the eval will produce a value. Without this change, a flag like my-flag will go through the eval as $my-flag. Since bash doesn't permit dashes in variable names, the resulting value will be -flag. Because this is a non-zero length, the first iteration through the for loop on ${e} will set in FLAGS, then break out. This leads to the improper result of FLAGS having -flag instead of the desired value of my-flag.

By testing that flag will produce a value before trying eval, we can be sure that the first loop iteration will proceed and allow the processing of the second iteration on ${flag} (which will correctly capture my-flag in our example).

${!flag+x} is used for indirect variable expansion. If flag contains the name of a variable, ${!flag} will expand to the value of that variable. The +x part ensures that the expression evaluates to true if the variable exists, even if it's empty.

This fixes #175.

This change adds a guard to a flag to ensure that the `eval` will produce a value. Without this change, a flag like `my-flag` will go through the `eval` as `$my-flag`. Since bash doesn't permit dashes in variable names, the resulting value will be `-flag`. Because this is a non-zero length, the first iteration through the for loop on `${e}` will set in `FLAGS`, then break out. This leads to the improper result of FLAGS having `-flag` instead of the desired value of `my-flag`.

By testing that flag will produce a value before trying `eval`, we can be sure that the first loop iteration will proceed and allow the processing of the second iteration on `${flag}` (which will correctly capture `my-flag` in our example).

${!flag+x} is used for indirect variable expansion. If flag contains the name of a variable, ${!flag} will expand to the value of that variable. The +x part ensures that the expression evaluates to true if the variable exists, even if it's empty.

This fixes codecov#175.
@rairulyle
Copy link

rairulyle commented May 2, 2024

Could we get an update on this situation? It's important for us as we can't move forward with deprecating the bash uploader until this issue is resolved. Thanks!

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.

Dashes and periods in flag names don't work in the Orb
2 participants