Allow braceless variables to be expanded
(Only in environment.d files.) We have only basic compatibility with shell syntax, but specifying variables without using braces is probably more common, and I think a lot of people would be surprised if this didn't work.
This commit is contained in:
+6
-1
@@ -773,7 +773,8 @@ static int merge_env_file_push(
|
||||
|
||||
assert(env);
|
||||
|
||||
expanded_value = replace_env(value, *env, REPLACE_ENV_USE_ENVIRONMENT);
|
||||
expanded_value = replace_env(value, *env,
|
||||
REPLACE_ENV_USE_ENVIRONMENT|REPLACE_ENV_ALLOW_BRACELESS);
|
||||
if (!expanded_value)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -787,6 +788,10 @@ int merge_env_file(
|
||||
FILE *f,
|
||||
const char *fname) {
|
||||
|
||||
/* NOTE: this function supports braceful and braceless variable expansions,
|
||||
* unlike other exported parsing functions.
|
||||
*/
|
||||
|
||||
return parse_env_file_internal(f, fname, NEWLINE, merge_env_file_push, env, NULL);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user