-
Notifications
You must be signed in to change notification settings - Fork 905
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
new(docker): allow passing options to falco-driver-loader from the cointainer image #2781
new(docker): allow passing options to falco-driver-loader from the cointainer image #2781
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
I would document it somewhere!
LGTM label has been added. Git tree hash: 3938e247ce188b768023e9c7d070fca35fb83e39
|
@@ -27,7 +27,8 @@ if [[ -z "${SKIP_DRIVER_LOADER}" ]]; then | |||
ln -s "$i" "/usr/src/$base" | |||
done | |||
|
|||
/usr/bin/falco-driver-loader | |||
falco_driver_loader_option_arr=($FALCO_DRIVER_LOADER_OPTIONS) | |||
/usr/bin/falco-driver-loader "${falco_driver_loader_option_arr[@]}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/bin/falco-driver-loader "${falco_driver_loader_option_arr[@]}" | |
/usr/bin/falco-driver-loader ${falco_driver_loader_option_arr[@]} |
why do we need "
here? 🤔
what will happen if $FALCO_DRIVER_LOADER_OPTIONS
contains "
? 🤔
/hold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not a good PR review if nobody mentions either mystifying Bash rules or the C standard.
The "
is there to prevent variable globbing and expansion, meaning that if you pass a *
in the array it will not expand to all files in this directory. Then I tried and I noticed that there is a mistake in the line above, which should be read -a args_arr <<< $FALCO_DRIVER_LOADER_OPTIONS
because otherwise ... variable expansion will happen anyways. So I'm going to fix that.
To answer the second part of the question, arguments are simply space-delimited (technically, $IFS
delimited).
You can verify by copying these two scripts:
print-args.sh
#!/bin/bash
for arg
do
printf '%s\n' "$arg"
done
args-from-env.sh
#!/bin/bash
read -a args_arr <<< $MY_ARGS
echo "--- with quotes ---"
./print-args.sh "${args_arr[@]}"
echo "--- without quotes ---"
./print-args.sh ${args_arr[@]}
echo "--- without quotes and array conversion ---"
./print-args.sh ${MY_ARGS}
and running MY_ARGS='hello bash * old not friend' ./args-from-env.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/hold cancel
…ntainer image Signed-off-by: Luca Guerra <luca@guerra.sh>
Signed-off-by: Luca Guerra <luca@guerra.sh>
99b9bcc
to
36a36f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
LGTM label has been added. Git tree hash: b438a74e81397f2103ed78c7e8c9aa51cbbc8169
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Andreagit97, FedeDP, LucaGuerra The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
/area build
What this PR does / why we need it:
Sometimes we may want to specify options for the driver loader script, for example when we may decide to only download or compile the eBPF probe rather than the kmod. This is not strictly required, more like something that is nice to have.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: