-
Notifications
You must be signed in to change notification settings - Fork 4
Escape \ in environment variable
#168
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
base: v3.x/staging
Are you sure you want to change the base?
Conversation
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
Signed-off-by: Martin Zeithaml <[email protected]>
src/main.c
Outdated
| 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) { |
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.
Nit: you could make this const char *key while you're at it :)
src/main.c
Outdated
|
|
||
| static bool is_valid_key(char *key) { | ||
| // Zowe.environments key must follow Unix variable name syntax: | ||
| // alphaNum | underscore & first char is not a digit |
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.
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
|
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 <[email protected]>
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.