CSS class selector matches a suffix, not only a whole word

Bug #1416695 reported by Alex Valavanis
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned
inkscape (Debian)
New
Unknown

Bug Description

From: Kalle Olavi Niemitalo <email address hidden>
To: Debian Bug Tracking System <email address hidden>
Subject: inkscape: CSS class selector matches a suffix, not only a whole word
Date: Tue, 13 Jul 2010 15:01:45 +0300
[Message part 1 (text/plain, inline)]
Package: inkscape
Version: 0.47.0-2+b1
Severity: minor

If the SVG file includes a CSS rule for the selector
"rect.world", then it should match "rect" elements whose "class"
attribute contains the word "world". In Inkscape however, it
matches "rect" elements whose "class" attribute contains any word
ending with "world". I'm attaching a file that demonstrates the
bug.

class="helloworld" (large circle): Bug; matches but shouldn't
class="hello" (vertical ellipse): OK, doesn't match
class="world" (horizontal ellipse): OK, matches
class="hello world" (small circle): OK, matches

This bug seems to be in src/libcroco/cr-sel-eng.c
(class_add_sel_matches_node): after strncmp has returned a
nonzero value, which means the word did not match, the loop
increments cur by only one character instead of skipping the
whole word. In bug #427946, it is said that the src/libcroco/
included in inkscape was forked from libcroco 0.6. I don't know
whether the class matching code has been fixed in the upstream
libcroco since.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages inkscape depends on:
ii libaspell15 0.60.6-4 GNU Aspell spell-checker runtime l
ii libatk1.0-0 1.30.0-1 The ATK accessibility toolkit
ii libc6 2.11.2-2 Embedded GNU C Library: Shared lib
ii libcairo2 1.8.10-4 The Cairo 2D vector graphics libra
ii libcairomm-1.0-1 1.8.4-3 C++ wrappers for Cairo (shared lib
ii libfontconfig1 2.8.0-2.1 generic font configuration library
ii libfreetype6 2.3.11-1 FreeType 2 font engine, shared lib
ii libgc1c2 1:6.8-1.2 conservative garbage collector for
ii libgcc1 1:4.4.4-6 GCC support library
ii libgconf2-4 2.28.1-3 GNOME configuration database syste
ii libglib2.0-0 2.24.1-1 The GLib library of C routines
ii libglibmm-2.4-1c2a 2.24.2-1 C++ wrapper for the GLib toolkit (
ii libgnomevfs2-0 1:2.24.3-1 GNOME Virtual File System (runtime
ii libgomp1 4.4.4-6 GCC OpenMP (GOMP) support library
ii libgsl0ldbl 1.14+dfsg-1 GNU Scientific Library (GSL) -- li
ii libgtk2.0-0 2.20.1-1 The GTK+ graphical user interface
ii libgtkmm-2.4-1c2a 1:2.20.3-1 C++ wrappers for GTK+ (shared libr
ii libgtkspell0 2.0.16-1 a spell-checking addon for GTK's T
ii liblcms1 1.18.dfsg-1.2+b2 Color management library
ii libmagick++3 7:6.6.0.4-2 object-oriented C++ interface to I
ii libmagickcore3 7:6.6.0.4-2 low-level image manipulation libra
ii libpango1.0-0 1.28.1-1 Layout and rendering of internatio
ii libpangomm-1.4-1 2.26.2-1 C++ Wrapper for pango (shared libr
ii libpng12-0 1.2.44-1 PNG library - runtime
ii libpoppler-glib4 0.12.4-1 PDF rendering library (GLib-based
ii libpoppler5 0.12.4-1 PDF rendering library
ii libpopt0 1.16-1 lib for parsing cmdline parameters
ii libsigc++-2.0-0c2a 2.2.4.2-1 type-safe Signal Framework for C++
ii libstdc++6 4.4.4-6 The GNU Standard C++ Library v3
ii libwpd8c2a 0.8.14-1 Library for handling WordPerfect d
ii libwpg-0.1-1 0.1.3-1 WordPerfect graphics import/conver
ii libx11-6 2:1.3.3-3 X11 client-side library
ii libxml2 2.7.7.dfsg-2 GNOME XML library
ii libxslt1.1 1.1.26-3 XSLT processing library - runtime
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages inkscape recommends:
ii aspell 0.60.6-4 GNU Aspell spell-checker
ii imagemagick 7:6.6.0.4-2 image manipulation programs
ii libwmf-bin 0.2.8.4-6.1 Windows metafile conversion tools
ii perlmagick 7:6.6.0.4-2 Perl interface to the ImageMagick
ii pstoedit 3.45-8+b1 PostScript and PDF files to editab

Versions of packages inkscape suggests:
pn dia | dia-gnome <none> (no description available)
ii libgnomevfs2-extra 1:2.24.3-1 GNOME Virtual File System (extra m
pn libsvg-perl <none> (no description available)
pn libxml-xql-perl <none> (no description available)
ii python 2.6.5-5 An interactive high-level object-o
pn python-lxml <none> (no description available)
ii python-numpy 1:1.3.0-3+b2 Numerical Python adds a fast array
pn python-uniconvertor <none> (no description available)
pn ruby <none> (no description available)
pn skencil <none> (no description available)
pn ttf-bitstream-vera <none> (no description available)

-- no debconf information
[cssbug.svg (image/svg+xml, attachment)]
[Message part 3 (application/pgp-signature, inline)]
Message #10 received at <email address hidden> (full text, mbox, reply):

From: Kalle Olavi Niemitalo <email address hidden>
To: <email address hidden>
Subject: Re: Bug#588912: inkscape: CSS class selector matches a suffix, not only a whole word
Date: Mon, 14 May 2012 12:42:11 +0300
[Message part 1 (text/plain, inline)]
Package: inkscape
Version: 0.48.3.1-1+b1

To clarify: the large circle near the top left corner of
http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=cssbug.svg;att=1;bug=588912
should have a dark grey stroke and a light grey fill,
but Inkscape instead shows a red stroke.

Tags: css styles
Revision history for this message
Alex Valavanis (valavanisalex) wrote :
Changed in inkscape (Debian):
status: Unknown → New
su_v (suv-lp)
tags: added: css
Revision history for this message
su_v (suv-lp) wrote :

AFAICT already tracked in
- Bug #855191 “Classes and styles: incorrect parsing?”
  <https://bugs.launchpad.net/inkscape/+bug/855191>

Tests with old releases and devel builds:
- reproduced with Inkscpape 0.48.5
- reproduced with Inkscape 0.48+devel rev <= 12763
- not reproduced with Inkscape 0.48+devel rev >= 12771
- not reproduced with Inkscape 0.91
indicate that this was fixed by merging upstream libcroco changes into trunk's copy:
<http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/changes/12771>

Linking as duplicate to bug #855191. Please add a comment and revert the duplicate status if you disagree and think this was done in error.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.