Skip to content
  • Philip Withnall's avatar
    gkeyfile: Temporarily re-allow invalid escapes when parsing strings · 4a967276
    Philip Withnall authored
    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 `GError`s,
    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](https://specifications.freedesktop.org/desktop-entry-spec/latest/ar01s04.html)
    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
    
     for tracking
    re-enabling the error handling for invalid escape sequences.
    
    Signed-off-by: default avatarPhilip Withnall <philip@tecnocode.co.uk>
    
    Fixes: #3095
    See: #3098
    4a967276