inkscape loads extension even if the script specified in <command> doesn't exist

Bug #505920 reported by Aurèle Duda
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
jazzynico

Bug Description

if an .inx file contains a <command> element pointing to an inextisting script, the extension is loaded (with non report in extension-errors.log).

So, when you launch the extension, inkscape complains about the python args.

The script used in <command> element should exist in <dependencies>

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

not reproduced with Inkscape 0.47 on OS X 10.5.8

$ grep command debug.inx
    <command reldir="extensions" interpreter="python">debug.py</command>
$ mv debug.py debug-disabled.py

(launch Inkscape.app, menu entry is missing, quit)

$ cat ../extension-errors.log
Extension "Python module info" failed to load because a dependency was not met.
Dependency:
  type: executable
  location: extensions
  string: debug.py

Please provide information about your OS and Inkscape version.

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

> The script used in <command> element should exist in <dependencies>
sorry, I overlooked the last sentence - my debug extension had:

$ grep dependency debug.inx
  <dependency type="executable" location="extensions">debug.py</dependency>
  <dependency type="executable" location="extensions">inkex.py</dependency>

reproduced if the script is not added as dependency.

Changed in inkscape:
status: New → Confirmed
Revision history for this message
Alvin Penner (apenner) wrote :

strictly speaking, I do not think this is a bug. This is the way dependency statements are designed to operate. They specify which modules are mandatory. It is the responsibility of the script developer to make sure that the dependency statement accurately reflects the needs of the extension, otherwise the dependency statement would be redundant.

Revision history for this message
Aurèle Duda (aureleduda) wrote :

So if you specify no dependency at all in an extension and provide a <command> element pointing to a nonexistent script, inkscape will load the extension without complaining at all...
I understand the dependency statement, but I do not think it's a good thing there is no check about <command>.
Inkscape should at least indicate the lack of script a little more understandable.

jazzynico (jazzynico)
Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Low
su_v (suv-lp)
tags: removed: python
jazzynico (jazzynico)
Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
Rena Kunisaki (i-am-inuyasha) wrote :

Was about to suggest that the file specified in <command> should not also need to be specified in <dependency>, as it's redundant. Not sure if that's exactly what's being reported here.

Revision history for this message
jazzynico (jazzynico) wrote :

The attached patch checks to command element as if it were a dependency (in fact, dependency elements with type="executable" are very close to command elements).
If the command value is invalid, Inkscape doesn't load the extension and add a dependency type error in the extension-error.log file.

Changed in inkscape:
milestone: none → 0.91
status: Triaged → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Tested on Windows XP, Inkscape trunk revision 13328.

Revision history for this message
jazzynico (jazzynico) wrote :

Also tested successfully on Crunchbang Waldorf.

Fixed in the trunk, revision 13421.

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

It appears that the change in r13421 introduces a crash on launch if there is a comment <!-- --> inside the <script> element. It does not matter whether the extension is actually loaded (check successful) or not (e.g. script not found), nor whether the extension is loaded from the shared or the user extensions directory.

Testing with archived builds (on OS X 10.7.5): no crash with rev13419, crash with rev13421

@JazzyNico - would you prefer if this is filed as separate report?

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

Follow-up report filed as
- Bug #1372200 “Comment within <script> element in INX file triggers crash on launch (rev >= 13421)”
  https://bugs.launchpad.net/inkscape/+bug/1372200

jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
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.