diff options
author | Alan Dunn <amdunn@google.com> | 2016-03-14 17:40:47 -0700 |
---|---|---|
committer | Sam Mendoza-Jonas <sam@mendozajonas.com> | 2016-03-15 14:10:00 +1100 |
commit | 6e5cd61065181460be8152a73dfc79f94ecd27fe (patch) | |
tree | 62a597293437291e9e495af53d5eaa1714dfcb60 /test/parser | |
parent | c005b174aa484ecafdbd403af80ea7375b67bc31 (diff) | |
download | talos-petitboot-6e5cd61065181460be8152a73dfc79f94ecd27fe.tar.gz talos-petitboot-6e5cd61065181460be8152a73dfc79f94ecd27fe.zip |
In GRUB2 parser save_env, treat unset variable value as empty
It seems better to treat unset variable values as empty rather than
crashing in save_env. While GRUB's behavior is actually to delete the
variable from the environment block, it seems useful to at least not
crash while later on someone can do further work to improve GRUB
compatibility if desired.
Tested:
Modified test-grub2-save-env to cover this case.
Signed-off-by: Alan Dunn <amdunn@google.com>
Signed-off-by: Sam Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'test/parser')
-rw-r--r-- | test/parser/test-grub2-save-env.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/parser/test-grub2-save-env.c b/test/parser/test-grub2-save-env.c index 68e91bd..36725e2 100644 --- a/test/parser/test-grub2-save-env.c +++ b/test/parser/test-grub2-save-env.c @@ -74,6 +74,12 @@ struct env_test { "a=xxx\nsave_env a\n", "q=q\na=x\nr=r\n#", }, + { + "unset-var", + "##############", + "save_env an_unset_var\n", + "an_unset_var=\n" + } }; static void run_env_test(struct parser_test *test, struct env_test *envtest) |