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

[Bug]: Make variable substitution corrupts regex (or escaping rules undocumented!) #1045

Closed
ahmedneilhussain opened this issue May 4, 2023 · 0 comments · Fixed by #1056
Closed
Assignees
Labels
bug Something isn't working

Comments

@ahmedneilhussain
Copy link

What happened?

Porting some code from build_bazel_rules_nodejs to use rules_js, I replaced a genrule with js_run_binary. Command line flags containing regexes that worked fine with genrule get corrupted when passed to the args attribute of js_run_binary.

These used to work fine using genrule:

    "--ignore-custom-fragments='/{{[{]?(.*?)[}]?}}/'",
    "--ignore-custom-fragments='/{%(.*?)%}/'",

In js_run_binary they get corrupted, and in fact as it stands cause the shell script runner to blow up before even invoking the binary, I think because the input gets truncated after the first % of the second CLI arg and you get a shell complaint about the unmatched quote.

I presume makefile variable expansion is causing the problem but I would have expected the substitution to behave the same as native genrule?

Version

Development (host) and target OS/architectures: MacOS Ventura 13.3.1a/x86

Output of bazel --version:
bazel 7.0.0-pre.20230316.2

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:
https://github.com/aspect-build/rules_js/archive/002397780d51735f1a98b362fca7018df31e85ac.tar.gz
(needed to use a commit because a fix for newer syntax of pnpm-lock.yaml files isn't/wasn't yet in a released build).

Language(s) and/or frameworks involved:

How to reproduce

Build a simple node binary that echoes its arguments and pass those in - should be malformed.

Any other information?

No response

@ahmedneilhussain ahmedneilhussain added the bug Something isn't working label May 4, 2023
@github-actions github-actions bot added the untriaged Requires traige label May 4, 2023
@jbedard jbedard self-assigned this May 9, 2023
@jbedard jbedard removed the untriaged Requires traige label May 9, 2023
jbedard added a commit to jbedard/rules_js that referenced this issue May 9, 2023
jbedard added a commit to jbedard/rules_js that referenced this issue May 9, 2023
jbedard added a commit to jbedard/rules_js that referenced this issue May 9, 2023
@jbedard jbedard moved this to 👀 In review in Open Source May 10, 2023
jbedard added a commit to jbedard/rules_js that referenced this issue May 11, 2023
jbedard added a commit that referenced this issue May 11, 2023
Fix #1045

The minimum bazel-lib version was updated to 1.32.2 to include bazel-contrib/bazel-lib@b5e9238
@github-project-automation github-project-automation bot moved this from 👀 In review to ✅ Done in Open Source May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants