pulsar
pulsar copied to clipboard
[fix] Reapply shell script parameter passthrough fix #22867 reverted in #22921
This reverts commit fa745384c2c3ea8c16e6c0cd078328a653fa3073.
Motivation
#22921 reverted the change in #22867 to use correct way of passing parameters in shell scripts.
The correct syntax is "$@".
In #22921, the argumentation was that a command bin/pulsar zookeeper-shell --run-once "ls /ledgers" no longer works.
This type of command has always been invalid for 2 reasons:
bin/pulsar zookeeper-shellhas never supported--run-onceparameter.- there's a Python based
zk-shellwhich supports this syntax.bin/pulsar zookeeper-shelldoesn't usezk-shellunder the covers.
- there's a Python based
bin/pulsar zookeeper-shellhas never supported quoting the arguments to the command. This happened to work because of invalid parameter passing which is fixed by #22867- The Python based
zk-shellrequires the--run-once "ls /path"syntax.bin/pulsar zookeeper-shelldoesn't usezk-shellunder the covers.
- The Python based
Modifications
- revert commit fa745384c2c3ea8c16e6c0cd078328a653fa3073 / PR #22921
Documentation
- [ ]
doc - [ ]
doc-required - [x]
doc-not-needed - [ ]
doc-complete
I hope we get the scripts fixed, at least for master branch. It's clearly a problem to use $@ without double quotes to pass parameters on to another command. That's why I think that this change should be made "$@".
$@
When you use $@ without quotes, it expands to each positional parameter as a separate word. This means that if any of the arguments contain spaces, they will be split into multiple words. For example, if a script is run with the arguments one two and three, $@ would treat them as three separate arguments: one, two, and three.
"$@"
When you use "$@" with double quotes, it expands to each positional parameter preserved as a single word, regardless of spaces. This means that each argument is treated exactly as it was passed, including spaces. For example, if a script is run with the arguments “one two“ and three, "$@" would treat them as two arguments: ”one two“ and three.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 74.32%. Comparing base (
bbc6224) to head (28a69ee). Report is 653 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #22923 +/- ##
============================================
+ Coverage 73.57% 74.32% +0.75%
- Complexity 32624 34350 +1726
============================================
Files 1877 1949 +72
Lines 139502 146867 +7365
Branches 15299 16168 +869
============================================
+ Hits 102638 109160 +6522
- Misses 28908 29284 +376
- Partials 7956 8423 +467
| Flag | Coverage Δ | |
|---|---|---|
| inttests | 27.54% <ø> (+2.95%) |
:arrow_up: |
| systests | 24.44% <ø> (+0.12%) |
:arrow_up: |
| unittests | 73.67% <ø> (+0.82%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.