Skip to content

gkeyfile: Temporarily re-allow invalid escapes when parsing strings

Philip Withnall requested to merge pwithnall/glib:keyfile-invalid-escapes into main

Before commit 71b7efd0, GKeyFile incorrectly allowed invalid escape sequences: it would treat the sequence as a literal, set a GError, but not return failure from the function. So if a caller was explicitly checking for returned GErrors, they could detect the invalid escape; but if they were just checking the function’s return value, they’d miss it.

This is not correct use of GError, and the Desktop Entry Spec doesn’t allow for invalid escape sequences to be accepted. So it’s wrong in both ways.

However, the commit above changed this behaviour without realising it, quite close to the 2.78 stable release deadline. There are numerous key files in the wild which use invalid escape sequences, and it’s too late in the cycle to ‘break’ parsing of all of them.

So, for now, revert to the old behaviour for invalid escape sequences, and give people another cycle to adapt to the changes. This will likely mean they end up calling g_key_file_get_value() rather than g_key_file_get_string(). See #3098 (closed) for tracking re-enabling the error handling for invalid escape sequences.

Signed-off-by: Philip Withnall philip@tecnocode.co.uk

Fixes: #3095 (closed) See: #3098 (closed)

Merge request reports