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 596429 - GScanner ignores skip_comment_multi if "/" is allowed in identifiers.
GScanner ignores skip_comment_multi if "/" is allowed in identifiers.
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: general
2.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2009-09-26 14:24 UTC by Julian Andres Klode
Modified: 2018-05-24 11:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test case (1.04 KB, text/x-vala)
2009-09-28 14:12 UTC, Julian Andres Klode
Details

Description Julian Andres Klode 2009-09-26 14:24:13 UTC
The code in http://git.debian.org/?p=users/jak/apt2.git includes a GScanner based parser for APT configuration files. I set the option skip_comment_multi to true and set cset_identifier_nth and cset_identifier_first to a_2_z + A_2_Z + DIGITS + "/-:._+". If I now parse a file, with a comment like /* alpha */, '/' would be treated as an identifier and '*' as a character; although it should completely ignore the comment.
Comment 1 Sebastian Dröge (slomo) 2009-09-28 08:50:55 UTC
Could you attach a small sample to reproduce this problem? This makes it much easier to fix
Comment 2 Julian Andres Klode 2009-09-28 14:12:24 UTC
Created attachment 144176 [details]
Test case

This attachment contains a test code written in Vala which reproduces the bug. Unsetting the identifier settings would cause no errors, with identifiers set it causes an error.
Comment 3 Julian Andres Klode 2009-12-17 15:17:53 UTC
Any update here? The solution would be to read a second character if a '/' was read and if the second character is a '*', treat is as a comment.
Comment 4 Julian Andres Klode 2009-12-17 15:23:46 UTC
The cause of all this is:

      /* this is *evil*, but needed ;(
       * we first check for identifier first character, because	 it
       * might interfere with other key chars like slashes or numbers
       */
      if (config->scan_identifier &&
	  ch && strchr (config->cset_identifier_first, ch))

The following check checks whether the character actually starts a comment:

      if (config->scan_identifier &&
	  ch && strchr (config->cset_identifier_first, ch))
	  if (!(config->scan_comment_multi && ch = '/' &&
	      g_scanner_peek_next_char (scanner) == '*'))

Adding this should fix the bug.
Comment 5 GNOME Infrastructure Team 2018-05-24 11:58:56 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/glib/issues/242.