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: correctly split quoted args #909

Merged
merged 1 commit into from
Aug 19, 2024

Conversation

gregmagolan
Copy link
Collaborator

@gregmagolan gregmagolan commented Aug 19, 2024

Fixes #891 (requested by Bazel Open Source Support customer).


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

New function split_args is added to the public API of strings.bzl.

This fix touches a number of different rules:

  • jq rule expansions now include make vars and rule fixed to single quote args that contain spaces
  • expand_template optimized to not to bother with pointless .split(" ") followed by " ".join()
  • bats_test optimized to not to bother with pointless .split(" ") followed by " ".join()
  • params_file rule fixed to correctly split args on quotes
  • run_binary rule fixed to correctly split args on quotes

Test plan

  • Covered by existing test cases
  • New test cases added

Unit tests added for the new split_args function that handles parsing args and splitting them taking into account single quotes, double quotes and escapes.

Copy link

aspect-workflows bot commented Aug 19, 2024

Test

1 test target passed

Targets
//docs:update_29_test [k8-fastbuild] 69ms

Total test execution time was 69ms. 220 tests (99.5%) were fully cached saving 30s.


Test

e2e/copy_action

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/copy_to_directory

All tests were cache hits

6 tests (100.0%) were fully cached saving 750ms.


Test

e2e/coreutils

All tests were cache hits

4 tests (100.0%) were fully cached saving 742ms.


Test

e2e/external_copy_to_directory

All tests were cache hits

1 test (100.0%) was fully cached saving 59ms.


Test

e2e/smoke

All tests were cache hits

6 tests (100.0%) were fully cached saving 2s.


Buildifier      Format      Gazelle

@gregmagolan gregmagolan force-pushed the handle_quoted_strings_in_args_split branch 2 times, most recently from 68fa390 to 8ae50b8 Compare August 19, 2024 18:27
@gregmagolan gregmagolan marked this pull request as ready for review August 19, 2024 18:32
lib/tests/base64_tests.bzl Outdated Show resolved Hide resolved
@gregmagolan gregmagolan force-pushed the handle_quoted_strings_in_args_split branch from 8ae50b8 to c8cb6a5 Compare August 19, 2024 18:54
@gregmagolan gregmagolan force-pushed the handle_quoted_strings_in_args_split branch 3 times, most recently from 3fa4724 to fd62c80 Compare August 19, 2024 19:39
@gregmagolan gregmagolan force-pushed the handle_quoted_strings_in_args_split branch from fd62c80 to cdeead9 Compare August 19, 2024 19:42
@gregmagolan gregmagolan merged commit 73d021f into main Aug 19, 2024
36 checks passed
@gregmagolan gregmagolan deleted the handle_quoted_strings_in_args_split branch August 19, 2024 20:36
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.

[Bug]: run_binary() does not support args that contain spaces
2 participants