Invalid preferences.xml prompt caused by an extension script

Bug #626608 reported by Andrew Noble
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Medium
Unassigned

Bug Description

You can just write any id having a slash character. Such as:

<inkscape-extension>
 <_name>myextension</_name>
 <id>python.mysite.com/svg2css</id>

The id is registered to preferences.xml which will cause the prompt on the next Inkscape start.

Related topic in InkscapeForum.com:
<http://www.inkscapeforum.com/viewtopic.php?f=5&t=5910>

su_v (suv-lp)
tags: added: extensions-plugins
Revision history for this message
su_v (suv-lp) wrote :

Can you attach your extension files? What platform are you working on, with which Inkscape version?

When testing this type of 'id' (an URL with sub-directory, using a slash) with an existing 'effect' extension (a copy of 'Modify Path > Scatter...' in ~/.config/extensions):

<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
  <_name>Scatter (LeWitt) python.mysite.com/svg2css</_name>
  <id>python.mysite.com/svg2css</id>

Inkscape stores the settings in preferences.xml inside a group like this:

    <group
       svg2css.follow="1"
       svg2css.grouppick="1"
       svg2css.pickmode="rand"
       svg2css.toffset="0"
       svg2css.noffset="0"
       svg2css.space="5"
       id="python.mysite.com"
       svg2css.duplicate="1"
       svg2css.copymode="copy" />
  </group>

Inkscape does launch after a restart without error reading the preferences file and also correctly loads the previously used settings for the extension dialog.
(tested with Inkscape 0.48+devel r9731 on OS X 10.5.8)

Revision history for this message
su_v (suv-lp) wrote :

Only reproduced when using a backslash in the id (works with a normal slash).

Revision history for this message
su_v (suv-lp) wrote :

Confirmed for using backslashes ('\') as part of the 'ID' string
(tested on OS X, and on Windows, as reported on irc by cm9)

Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
description: updated
description: updated
Revision history for this message
Craig Marshall (craig9-deactivatedaccount) wrote :

I have tried here on 0.48 and 0.48+devel on Win7, and can't make it crash with a forward slash, but it does mess up the naming of the attributes. For example, if the id was x.y.z/foo, then the id within the group in the preferences.xml get set to just x.y.z, and the attributes of that group are prefixed with "foo.", like the example shown by ~suv above in comment 1.

I can get it to crash by putting either a 1 or 2 backslash characters into the INX id tag, presumably because \ is the escape character within C++ strings and either:

a) A bare \ is valid XML (I'm not sure), and it's not sanitised on reading the XML.
b) A bare \ is not valid XML, and it should be warned about when reading the INX file in.

Revision history for this message
su_v (suv-lp) wrote :

Console messages when getting the "The preferences file (...) is not a valid XML document." error:

Entity: line 1442: parser error : Specification mandate value for attribute python.mysite.com
     python.mysite.com\\svg2css.space="10"
                      ^
Entity: line 1442: parser error : attributes construct error
     python.mysite.com\\svg2css.space="10"
                      ^
Entity: line 1442: parser error : Couldn't find end of Start Tag group line 1194
     python.mysite.com\\svg2css.space="10"
                      ^
Entity: line 1442: parser error : Specification mandate value for attribute python.mysite.com
     python.mysite.com\\svg2css.space="10"
                      ^
Entity: line 1442: parser error : attributes construct error
     python.mysite.com\\svg2css.space="10"
                      ^
Entity: line 1442: parser error : Couldn't find end of Start Tag group line 1194
     python.mysite.com\\svg2css.space="10"
                      ^

Revision history for this message
su_v (suv-lp) wrote :

Console messages when using a single backslash:

Entity: line 1442: parser error : Specification mandate value for attribute python.mysite.com
     python.mysite.com\svg2css.space="10"
                      ^
Entity: line 1442: parser error : attributes construct error
     python.mysite.com\svg2css.space="10"
                      ^
Entity: line 1442: parser error : Couldn't find end of Start Tag group line 1194
     python.mysite.com\svg2css.space="10"
                      ^
Entity: line 1458: parser error : Opening and ending tag mismatch: inkscape line 2 and group
  </group>
          ^
Entity: line 1459: parser error : Extra content at the end of the document
  <group
  ^

Revision history for this message
Andrew Noble (noblestudd) wrote :

Hi All

I think I've hardcoded the forward slash inside preferences.xml.
It does filter the forward slash and inkscape turned it into code below and no error prompt:
  <group
     id="extensions">
    <group
       id="org.ekips.filter"
       hello_world.what="TEST" />
  </group>

But using an unmodified id from the template taken from the MakinAnINX tutorial the { } was not sanitized:
<inkscape-extension>
  <_name>{Friendly Extension Name}</_name>
  <id>{org.domain.sub-domain.extension-name}</id>

That's probably how I got the idea to tinker with preferences.xml directly.
My bad, I should have reported it more properly.

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

Other bug subscribers

Remote bug watches

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