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
Ensure config array variables are specified as arrays by the user #2930
Comments
Yes, My above example was only meant as an example how Basically all we do in ReaR (including all checks)
ReaR must never "patronize/infantilize" the user In general software that patronizes/infantilizes For checks in ReaR it means they inform the user But checks in ReaR are normally not meant to enforce
then ReaR must obey (because the user has final power) When ReaR cannot do what the user requested, |
Yes, the check only confirms that the syntax is correct, meaning that the user knew about the fact that this variable is an array and treats it as such. |
It is not yet completed, see |
Please have another look. |
Ah - I didn't understand where I should have a look but now I found Now it looks good to me (from plain looking at the code). A side note:
I did the following as currently logged in normal user:
so the unassigned array FUNCNAME gets skipped. Is it intentional to skip unassigned arrays?
better (i.e. without the '=')? |
Wow, thanks for taking a deep look at this. My original thinking was: If it hasn't been assigned then there is no potential for a wrong assignment, therefore it is enough to look at the arrays with content. |
It is fully sufficient in practice to only check assigned arrays. |
It can lead to various rather unexpected behaviour
when an array variable is not set as an array
but usually as a string instead.
For example:
In bash assinging a string to an array
assingns the first array element to that string:
But an array with an empty first element is something different
than an empty array which can make big differences in how
things behave, see for example
#2911
therein in particular
#2911 (comment)
and subsequent comments.
From the bash manpage section "Arrays":
To avoid that users set config array variables
as something that is not an array we should check
after sourcing the config files that the array variables
that are set in default.conf are still arrays.
See
#2925 (comment)
The text was updated successfully, but these errors were encountered: