Support UTF-8 and space characters in cibsecret#4118
Open
clumens wants to merge 6 commits into
Open
Conversation
We need to set LC_ALL before calling g_option_context_parse_strv so glib knows how to handle UTF-8 parameters. Otherwise, we'll get an invalid byte sequence error. This is not surrounded by #ifdef ENABLE_NLS since it should be safe to do anyway. Really, we should probably be doing this early in every command line tool. If NLS is enabled, we'll do this in crm_log_preinit but that's too late - that function gets called by crm_log_init, which is called by pcmk__cli_init_logging, which is typically called after command line parameters are parsed (because we need to know how many -Vs were given). Thus, it needs to be done separately and earlier. However in the interests of not introducing too many changes this late in a release, I'm only making this change to the one tool that has a bug filed against it. This only started being a problem once cibsecret was rewritten in C. Fixes RHEL-178864
Because cibsecret calls crm_resource in various places, it also needs to call setlocale. It's unclear to me why this needs to be done now instead of always. I don't see anything that's changed in crm_resource, and the old bash-based cibsecret also called crm_resource. Still, this should be safe to call from this tool as well.
When cibsecret was written in shell, it was quoting command line arguments like this. I'm not certain it's all strictly necessary (for instance, are characters that would need to be quoted valid in resource IDs?) it's best to follow what we were previously doing and be safe. At the least, it's possible for the values of secrets to have spaces in them which would require quoting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.