Gimp XCF export fails when exporting from an unsaved new document

Bug #650890 reported by jazzynico
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
jazzynico
inkscape (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Noticed on Windows XP and Ubuntu 10.04, Inkscape 0.47 and 0.48.

Steps:
1. Create a blank new document.
2. Use File>Save a Copy. Inkscape returns [1]
2b. Use File>Save as. Inkscape returns [2]

Related to Bug #642417 (Will not save .xcf file)? Message [2] looks like the one in comment 16.

Patch in progress.

[1]
No matching node for expression: /svg:svg/@sodipodi:docname
Traceback (most recent call last):
File "gimp_xcf.py", line 185, in <module>
    e.affect()
File "C:\Documents and Settings\dfr\Bureau\Devel\Inkscape\inkscape-0.48\share\extensions\inkex.py", line 215, in affect
    self.effect()
File "gimp_xcf.py", line 43, in effect
    docname = self.xpathSingle('/svg:svg/@sodipodi:docname')[:-4]
TypeError: 'NoneType' object is unsubscriptable

[2]
Traceback (most recent call last):
File "gimp_xcf.py", line 185, in <module>
    e.affect()
File "C:\Documents and Settings\dfr\Bureau\Devel\Inkscape\inkscape-0.48\share\extensions\inkex.py", line 215, in affect
    self.effect()
File "gimp_xcf.py", line 179, in effect
    x = open(xcf, 'r')
IOError: [Errno 2] No such file or directory: 'c:\\docume~1\\dfr\\locals~1\\temp\\tmp6dvu0i\\New docume.xcf'

jazzynico (jazzynico)
tags: added: exporting xcf
Changed in inkscape:
assignee: nobody → JazzyNico (jazzynico)
importance: Undecided → Low
milestone: none → 0.48.1
status: New → In Progress
Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Confirmed (exactly as described) with inkscape_0.48.0-1ubuntu1

Changed in inkscape (Ubuntu):
status: New → Confirmed
Revision history for this message
jazzynico (jazzynico) wrote :

Attached is a patch for the trunk.
Tested and working on Windows XP and Ubuntu 10.04.

Revision history for this message
jazzynico (jazzynico) wrote :

(ok, due to an error, this is not a patch but the py file).
Please test and confirm!

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Using the file in comment #2 with inkscape_0.48.0-1ubuntu1:

Save As XCF gives:

Traceback (most recent call last):
  File "gimp_xcf.py", line 221, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 215, in affect
    self.effect()
  File "gimp_xcf.py", line 209, in effect
    x = open(xcf, 'rb')
IOError: [Errno 2] No such file or directory: '/tmp/tmpEL6_Pf/New document 1.xcf'

Should I also be using the new .inx file from bug #642417?

Revision history for this message
jazzynico (jazzynico) wrote :

AV> Should I also be using the new .inx file from bug #642417?

Not, it should work if you update the python file only.
Did you test with Maverick or Lucid?

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

I was using Maverick with the version of gimp_xcf.inx from 0.48.0

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

@Alex - I've reproduced your bug with Maverick, but not with Lucid. It seems that something has changed in the way temporary files are handled. If it's the case, some other extensions are very likely to be affected too.
Are you still affected if you create a document, draw a shape, save it as SVG and then export (save as or save a copy) it to XCF with this last python file?

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

No, the new python file works fine if I save as SVG before exporting.

Revision history for this message
jazzynico (jazzynico) wrote :

Oh, I see... I didn't test my patch correctly (sorry, sorry, sorry). It should now work when the document is unsaved BUT has something to export (a shape, path, whatever fits in a layer...). If the document is completely blank, then there's nothing to export and that's the reason why the extension fails.
New fix in progress (mainly a warning message and an exit).

Revision history for this message
jazzynico (jazzynico) wrote :

Fixed extension attached (based on the trunk files). Please test!

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

The latest version of the extension (commenThis extension requires at least one non empty layer.t #10) appears to work as you planned it (comment #9).

Just a quick observation: when exporting an empty document, an empty "Drawing.xcf" (size 0B) is still created even though the warning message appears as planned. Is this behaviour intentional?

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Oops... that should have read as follows:

The latest version of the extension (comment #10) appears to work as you planned it (comment #9).

Just a quick observation: when exporting an empty document, an empty "Drawing.xcf" (size 0B) is still created even though the warning message appears as planned. Is this behaviour intentional?

Revision history for this message
jazzynico (jazzynico) wrote :

No, the empty file is not created on purpose.
AFAIK, this is a common behavior for all output type extension (I've already run into that kind of bug when debugging SVG+media exports). I don't know if it's possible to fix it from the python file, but I'd rather see the bug in the extensions implementation code (src/extension/implementation/script.cpp???)

Changed in inkscape (Ubuntu):
importance: Undecided → Low
status: Confirmed → Triaged
jazzynico (jazzynico)
summary: - GImp XCF export fail when exporting from an unsaved new document
+ Gimp XCF export fails when exporting from an unsaved new document
Revision history for this message
jazzynico (jazzynico) wrote :

Fix committed in the trunk (revision 9802) and in the 0.48.x branch (revision 9678). I've also added a fix that removes the temporary folder when the extension has finished (successfully or not) its job.

I've reproduced the empty file error with the sk1 extension, and thus I guess it's not directly related to XCF and can be reported as a separate report.

Changed in inkscape:
status: In Progress → Fix Committed
Revision history for this message
jazzynico (jazzynico) wrote :

Empty file bug reported in Bug #652943 (Aborted output extensions create an empty file).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package inkscape - 0.48.1-0ubuntu1

---------------
inkscape (0.48.1-0ubuntu1) natty; urgency=low

  * New upstream version (LP: #710619). Fixes several Ubuntu bugs:
    - Node editing causes segmentation fault (LP: #544599)
    - Cursor position markers are not cleared from rulers (LP: #627134)
    - Crashes when opening document properties (LP: #658055)
    - Export to XCF error with default template (LP: #485032)
    - Editing a connector in a transformed group returns it to original
      position (LP: #533897)
    - Ungrouping objects changes position of arrow lines (LP: #552289)
    - Will not save XCF file (LP: #642417)
    - XCF export fails when exporting from unsaved document (LP: #650890)
  * Drop all patches: Applied upstream
  * debian/rules: Disable chmod on debian/patches/* in clean rule (no patches used)
 -- Alexander Valavanis <email address hidden> Tue, 01 Feb 2011 12:53:34 +0000

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