Can't run custom extension in 0.48.1

Bug #792319 reported by zuencap
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
In Progress
Medium
jazzynico

Bug Description

I have a custom extension in java. Inx file includes this lines:

<command reldir="extensions" interpreter="java -jar">myext.jar</command>

It used to work in 0.47 version but in 0.48.1.r9760 I get:

Can't Spawn!!! spawn returns: Failed to execute child process "" (No such file or directory)

If I remove interpreter parameter I works under Ubuntu Lucid but I don't think this is the right solution.

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

Reproduced with Inkscape 0.48+devel r10252
Not reproduced with Inkscape 0.47 on OS X 10.5.8 (i386)

For testing, a simple test extension calling a shell script was used, with
a)
<command reldir="extensions" interpreter="bash">debug-interpreter.sh</command>
b)
<command reldir="extensions" interpreter="bash --login">debug-interpreter.sh</command>

Both variants work fine in 0.47, but fail in 0.48(+devel) with this error message:

Can't Spawn!!! spawn returns: Failed to execute child process "" (No such file or directory)

tags: added: regression
Changed in inkscape:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
su_v (suv-lp) wrote :

Note: for the test, the INX file and the shell script had been put into the user extensions directory:
  $HOME/.config/inkscape/extensions

Revision history for this message
jazzynico (jazzynico) wrote :

Reproduced on Windows XP, Inkscape trunk revision 11992.
Unfortunately, GDB returns no backtrace.

Changed in inkscape:
status: Confirmed → Triaged
Revision history for this message
ormris (useingubuntu) wrote :

Any progress on this bug?

Revision history for this message
jazzynico (jazzynico) wrote :

According to the RELAX NG XML schema (see http://wiki.inkscape.org/wiki/index.php/INX_extension_descriptor_format#RELAX_NG_XML_schema), the interpreter attribute should accept python or perl only, without any command line parameter.

...
       element command {
         inx.reldir.attr,
         attribute interpreter { "python" | "perl" }?,
         text
       },
...

And thus the current behavior could be considered valid (except that the error message should be a bit more clear).

But src/extension/implementation/script.cpp uses a table to associate the interpreter name to the appropriate executable ("python" returns "pythonw" on win32, and "python" on other systems), and accepts some interpreters that are not in the XML schema, such as "ruby" (associated with "ruby") and "shell" ("sh").

That said, the interpreter value seems to be used to retrieve the full executable path only, and using another name (bash, java) should work correctly providing that the executable is in the user's path and that the name match the executable name on all the systems the extension is installed.

Patch in progress.

Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
status: Triaged → In Progress
Revision history for this message
jazzynico (jazzynico) wrote :

Adding a "crash" tag. Not only unexpected interpreters don't work on Windows, but they also crash the application...

tags: added: crash
Revision history for this message
jazzynico (jazzynico) wrote :

First attempt to solve the issue.

The patch accepts any interpreter providing that it is in the path. Interpreter arguments are not supported yet (in that case, the interpreter is used without argument).

The Windows crash is worked around, but not solved (exception not correctly caught in Glib::spawn_async_with_pipes).

jazzynico (jazzynico)
Changed in inkscape:
milestone: none → 0.49
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi Jazzynico, you posted a WIP patch to this bug a year ago, would you mind updating us on the current status of the fix for this issue?

Revision history for this message
jazzynico (jazzynico) wrote :

Hi Bryce, it's still WIP because it doesn't work with arguments. I'll see if I can work on it before we freeze the code. If not, I'll commit my patch and update the report accordingly.
BTW, I've planned to update my other open reports soon.

Revision history for this message
jazzynico (jazzynico) wrote :

New patch that accepts arguments (debug code activated).
Quickly tested on Windows XP, Inkscape trunk revision 12923.
Really needs more tests on all systems.

Revision history for this message
jazzynico (jazzynico) wrote :

Improved patch.
Seems to work correctly with basic shell commands, but still returns java errors when running java -jar <javaexec>. Apparently related to the way the working directory is set.

su_v (suv-lp)
Changed in inkscape:
milestone: 0.91 → 0.92
jazzynico (jazzynico)
Changed in inkscape:
milestone: 0.92 → 1.0
Patrick Storz (ede123)
Changed in inkscape:
milestone: 1.0-old → 1.0
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.