summaryrefslogtreecommitdiff
path: root/test/internals
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-10-18 17:36:37 +0100
committerSimon McVittie <smcv@collabora.com>2018-10-19 11:11:55 +0000
commit4b46e9cb0f15120da05d9ab391aeb93298791285 (patch)
treed0ddfed243dacd0ec232978ba1f1e5de0dda40ca /test/internals
parent99580298f305e1e2426f0c016d797a1ff9ea0b79 (diff)
downloaddbus-4b46e9cb0f15120da05d9ab391aeb93298791285.tar.gz
desktop-file: Treat backslashes in section names as literal
The Desktop Entry Specification doesn't give any special meaning to backslashes in section names: a line "[\n]" starts a section whose name is the two characters (backslash, n), not a section whose name is a newline. GKeyFile in GLib matches this interpretation. In practice, the only section used by dbus-daemon is "D-BUS Service", only way this could make a difference is if someone had written it as "D-BUS\sService". According to https://codesearch.debian.net/search?q=%5C%5BD-BUS%5C%5CsService%5C%5D there is no instance of that pattern in Debian. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'test/internals')
-rw-r--r--test/internals/desktop-file.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/internals/desktop-file.c b/test/internals/desktop-file.c
index e4fef985..7f96b4d1 100644
--- a/test/internals/desktop-file.c
+++ b/test/internals/desktop-file.c
@@ -86,13 +86,19 @@ static const Test valid_content[] =
{ "odd whitespace",
"\n\n \n[D-BUS Service]\n \n",
-1 },
- /* Note that backslash is not included here. dbus-daemon currently
- * interprets group names in the same way as string values, with
- * backslash escapes interpreted; this does not appear to match
- * the Desktop Entry Specification or the implementation in GKeyFile. */
{ "Misc printable ASCII in section heading",
- "[abcxyzABCXYZ012789`!\"$%^&*()-_=+{}:;'@#~<,>./?|]",
+ "[abcxyzABCXYZ012789`!\"$%^&*()-_=+{}:;'@#~<,>./?|\\]",
-1 },
+ { "Backslash in section heading",
+ /* Section name consists of a single backslash followed by literal n
+ * (it is not a newline) */
+ "[\\n]\n"
+ "foo=bar",
+ -1,
+ "\\n",
+ "foo",
+ "bar",
+ "bar" },
{ "empty", "", -1 }
};