Skip to content
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

Fixes for environment variables sent to components #74

Merged
merged 8 commits into from
Mar 30, 2023

Conversation

pablocarle
Copy link
Contributor

@pablocarle pablocarle commented Mar 24, 2023

  • _CEE_ENVFILE* are not sent downwards to the components to avoid conflicts.
  • Send a memory copy of environment variable list.
  • Fix to send environment variables for zwe internal get-launch-components

Resolve #75

Pablo Hernán Carle and others added 5 commits March 24, 2023 10:25
- add comment for get_sharedenv function
- get-launch-components now gets the environment variables
- start-component trims values of environment variables.

Signed-off-by: Pablo Hernán Carle <[email protected]>
wip
Signed-off-by: Pablo Hernán Carle <[email protected]>
Signed-off-by: Pablo Hernán Carle <[email protected]>
Signed-off-by: Pablo Hernán Carle <[email protected]>
Signed-off-by: Pablo Hernán Carle <[email protected]>
src/main.c Outdated Show resolved Hide resolved
src/main.c Outdated Show resolved Hide resolved
src/main.c Outdated Show resolved Hide resolved
strcat(output, " ");
} else {
strcat(output, "=\"");
strcat(output, envValue);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quetos are not escaped

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean here, this code is from the previous version, just moved it up

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The JSON content is solved by jsonToString. The potential issue could come from shared_uss_env[idx++] = thisEnv;.

The proper solution there should probably be like this:

if (*thisEnv != '\"') {
 newstr = malloc(?);
 newstr[0] = 0; 
 strcat(newstr, key);
 strcat(newstr, "=");
 strcat(newstr, escapeString(thisEnv + length);
 length = newstr;
}

...anyway, I guess it is a bug, that could be solved in an issue. The workaround could be to use a different form in STC. And from another hand, it is pretty rear to set especially in this way string value with a quote.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened an issue based on testing done with these scenarios #76

src/main.c Show resolved Hide resolved
Signed-off-by: Pablo Hernán Carle <[email protected]>
@1000TurquoisePogs
Copy link
Member

Thank you, this is looking good to me as well so I'm going to merge it due to @pj892031 's approval.

@1000TurquoisePogs 1000TurquoisePogs merged commit 966b65f into v2.x/master Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Environment variables not properly working when sent in spawn syscall
3 participants