After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792179 - compose table parses escaped values incorrectly
compose table parses escaped values incorrectly
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Input Methods
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2018-01-03 17:21 UTC by Roderich Schupp
Modified: 2018-05-02 19:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (against master, but also applies to 3.22.26) (2.57 KB, patch)
2018-01-03 17:21 UTC, Roderich Schupp
none Details | Review

Description Roderich Schupp 2018-01-03 17:21:31 UTC
Created attachment 366254 [details] [review]
Proposed patch (against master, but also applies to 3.22.26)

I tried to add some custom compose sequence to my ~/.config/gtk-3.0/Compose,
e.g. the line

<Multi_key> <less> <minus> : "\20620" #LEFTWARDS ARROW

but Gtk reports the following error

GTK+ supports to output one char only: "\20620" #LEFTWARDS ARROW: <Multi_key> <less> <minus> : "\20620" #LEFTWARDS ARROW

The parsing is done in parse_compose_value() in gtk/gtkcomposetable.c
and it get's it wrong for \-escaped (octal) strings: the check

if (g_utf8_get_char (g_utf8_next_char (words[1])) > 0)
  g_warning ("GTK+ supports to output one char only: %s: %s", val, line);

is also applied when the string is escaped (where it is trivially true).

Parsing uses a lot of implicit state (e.g. for the handling of
compose_data->comment), is sometimes funny

     /* The escaped octal */
     else if (uch >= '0' && uch <= '8')     <--- '8' in an octal number?

and doesn't cover escaped hexadecimal strings like the original from libX11.

The syntax for the target string in libX11 modules/im/ximcp/imLcPrs.c is:

      STRING        ::= '"' { CHAR } '"'
      CHAR          ::= GRAPHIC_CHAR | ESCAPED_CHAR
      GRAPHIC_CHAR  ::= locale (codeset) dependent code
      ESCAPED_CHAR  ::= ('\\' | '\"' | OCTAL | HEX )
      OCTAL         ::= '\' OCTAL_CHAR [OCTAL_CHAR [OCTAL_CHAR]]
      OCTAL_CHAR    ::= (0|1|2|3|4|5|6|7)
      HEX           ::= '\' (x|X) HEX_CHAR [HEX_CHAR]]
      HEX_CHAR      ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f)

Patch attached that fixes the original problem and parses escaped hexadecimal strings, too. The problem is still present in Git master.

Of course, the suggestion in #773919 would be even better.
Comment 1 GNOME Infrastructure Team 2018-05-02 19:39:26 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/1004.