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

Quote arguments to check.sh #88

Merged
merged 2 commits into from
Feb 17, 2022
Merged

Conversation

jasonwhite
Copy link
Contributor

Arguments would get expanded before being passed to bash, which would cause the following configuration to fail:

clang-format-version: 12
check-path: '.'
exclude-regex: '(foo|bar)'

because check.sh would get run as:

check.sh 12 . LLVM (foo|bar)

And since '(' and '|' are special characters for bash, the action will immediately fail because of a syntax error.

Instead, it should get ran as:

check.sh "12" "." "LLVM" "(foo|bar)"

This should also ensure that check-path works with paths containing spaces.

Without this quoting, arguments would get expanded before being passed
to bash, which would cause the following configuration to fail:

    clang-format-version: 12
    check-path: '.'
    exclude-regex: '(foo|bar)'

because `check.sh` would get run as:

    check.sh 12 . LLVM (foo|bar)

And since '(' and '|' are special characters for bash, the action will
immediately fail because of a syntax error.

Instead, it should get ran as:

    check.sh "12" "." "LLVM" "(foo|bar)"
action.yml Outdated Show resolved Hide resolved
Copy link
Owner

@jidicula jidicula left a comment

Choose a reason for hiding this comment

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

Thanks for this fix!

@jidicula jidicula merged commit 25c3bd7 into jidicula:main Feb 17, 2022
@jasonwhite jasonwhite deleted the jw/fix-quotes branch February 17, 2022 19:16
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.

None yet

2 participants