Escape \ in environment variable#168
Open
Martin-Zeithaml wants to merge 24 commits intov3.x/stagingfrom
Open
Conversation
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
| static bool is_valid_key(char *key) { | ||
| // Zowe.environments key must follow Unix variable name syntax: | ||
| // alphaNum | underscore & first char is not a digit | ||
| static bool is_key_valid_unix_name(char *key) { |
Contributor
There was a problem hiding this comment.
Nit: you could make this const char *key while you're at it :)
|
|
||
| static bool is_valid_key(char *key) { | ||
| // Zowe.environments key must follow Unix variable name syntax: | ||
| // alphaNum | underscore & first char is not a digit |
Contributor
There was a problem hiding this comment.
The precedence of the operators is not very obvious. Could you add parenthesis?
(alphaNum | underscore) & first char is not a digit
Or just write it like this:
// Zowe.environments key must follow Unix variable name syntax:
// * The first char must not be a digit
// * Any characters must be either alphanumeric or an underscore
Contributor
|
The C part looks good to me. Since I don't really know the current state of the launcher, @1000TurquoisePogs could you review the "big picture" of this change? and the shell stuff :) |
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <66114686+Martin-Zeithaml@users.noreply.github.com>
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.
Changes
Fixes #76.
Problem 1
You can define such string in YAML.
When trying to run
internal start prepare:Because of incorrect escape, the variable
TEST1will break the command, correct escaping is"TE\\\"ST".Note: Such example is good one, because the command fails and launcher ends. But if you chain couple of wrong variables, it could end by creating unexpected variable.
Problem 2
You can define such environment variable in YAML. This variable should be ignored, otherwise launcher tries to set
1=1.escape_stringsolving Problem 1This function was escaping only
". Updated to escape\too.is_valid_keysolving Problem 2test/environments.shzowe.yaml.test/fakeRuntimeThis is needed for running new test. Schema files were updated to be small, it does not matter for this test.
test/files/zowe.environments.yamlTEST_VAR*for testing Problem 1# *** Ignored keys ***for testing of Problem 2zowe.runtimeDirectorymust be absolute path, resolved withos.realpath.