]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi-string: Unquote single-quoted strings as well as double
authorJames Le Cuirot <jlecuirot@microsoft.com>
Tue, 27 Jan 2026 17:12:34 +0000 (17:12 +0000)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 4 Feb 2026 14:58:06 +0000 (23:58 +0900)
This code is used to read data copied from /etc/os-release. According to
the spec[1], values can be enclosed in single quotes or double quotes.
Not handling single quotes results in the quotes appearing in the
systemd-boot menu, e.g. 'Gentoo Linux'.

[1] https://www.freedesktop.org/software/systemd/man/latest/os-release.html

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
src/boot/efi-string.c

index e7bf3a4702f639f84c009f1c786ec267bbb1a1cb..ca077a5096f2c0076b94b524862760dc1c0f31dc 100644 (file)
@@ -497,7 +497,8 @@ char* line_get_key_value(char *s, const char *sep, size_t *pos, char **ret_key,
                         value++;
 
                 /* unquote */
-                if (value[0] == '"' && line[linelen - 1] == '"') {
+                if ((value[0] == '"' && line[linelen - 1] == '"') ||
+                    (value[0] == '\'' && line[linelen - 1] == '\'')) {
                         value++;
                         line[linelen - 1] = '\0';
                 }