Save as xcf results in empty file on gentoo linux

Bug #168277 reported by Babelfish42
12
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Medium
Aaron C Spike

Bug Description

Saving as .xcf with layers (for later use with gimp) results in an empty
file.

The following lines are output at the console:

=====
(inkscape:23647): GLib-CRITICAL **: g_utf8_collate: assertion `str2 !=
NULL' failed
Extension::Script: Unknown error for pclose
: No such file or directory
=====

I'm running inkscape 0.44 on Gentoo Linux, but the same (or similar) error
is also reported to happen with 0.43.

Edit/Additional info:
with 0.44.1, I get a dialog box saying

======
** (inkscape:10707): WARNING **: Format autodetect failed. The file is
being opened as SVG.
This is a development version of GIMP. Debug messages may appear here.

No batch interpreter specified, using the default
'plug-in-script-fu-eval'.
plug-in 'script-fu' aborted before sending its procedure return values
Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 92, in ?
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 123, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 87, in effect
    x = open(xcf, 'r')
IOError: [Errno 2] No such file or directory: u'/tmp/tmpMZtaEp/test.xcf'
======

Revision history for this message
Horkana-users (horkana-users) wrote :

Originator: NO

script-fu is part of GIMP, those are gimp errors causing errors in
Inkscape

All this script/extension/plugin does is automate the process of opening a
SVG file in the gimp and then saving it again as XCF. GIMP can import SVG
and will give you many more options on how to control the input. I would
strongly recommend you try that workaround for now.

What version of GIMP are you using?

Revision history for this message
Bug Importer (bug-importer) wrote :

This happend both with the stable gimp version 2.2.12 and the development
release 2.3.14.

Well, at least the layers seem to be saved in the /tmp/tmpFOO/ directory,
so I could use them :-)

Would it be appropriate to report this as a gimp bug?
AFAIK gimp can't import SVG with layers/ top level groups as xcf layers,
so the problem seems to be collating the pngs to xcf layers, not converting
svg to png.

Revision history for this message
Babelfish42 (babelfish42) wrote :

Originator: YES

Correction: I couldn't reproduce it with 2.2.12, xcf didn't even show up
as an option, so it could be that this is 2.3.x specific. Nor could it be
reproduced by another person I asked, on Ubuntu.
I'll probably cross-post this as a bug on gentoo, maybe they did some
hacks that went wrong.

Revision history for this message
Prokoudine (prokoudine) wrote :

Originator: NO

Can you reproduce it now?

Revision history for this message
Babelfish42 (babelfish42) wrote :

Originator: YES

Yes I can still reproduce it now, with Inkscape 0.45.1 and Gimp 2.4.0
(could 2.4.1 possibly make a difference?). The inkscape error dialog
message is a bit different now, though, saying;

======
** (inkscape:7098): WARNING **: Format autodetect failed. The file is
being opened as SVG.
No batch interpreter specified, using the default
'plug-in-script-fu-eval'.

(gimp:7101): Gimp-Base-WARNING **: tile cache not empty (3130752 bytes
left)
Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 92, in ?
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 157, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/gimp_xcf.py", line 87, in effect
    x = open(xcf, 'r')
IOError: [Errno 2] No such file or directory:
u'/tmp/tmp5pSrre/ink_ext_6N.xcf'
======

Indeed /tmp/tmp5pSrre/ink_ext_6N.xcf does not exist, but there is:

======
$ ls -l /tmp/tmp5pSrre/
total 20
-rw-r--r-- 1 daniel users 127 Nov 1 10:52 junk_from_gimp.txt
-rw-r--r-- 1 daniel users 13871 Nov 1 10:52 layer1.png
$ cat /tmp/tmp5pSrre/junk_from_gimp.txt
Welcome to TinyScheme, Version 1.38
Copyright (c) Dimitrios Souflis

> png-to-layer
> Error: car: argument 1 must be: pair

>
======

This error message lets me hope for an easy fix :-) Sorry I don't know
either TinyFu nor python...

vonHalenbach (lustik)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Aaron Spaulding (psychoaliendog) wrote :

I also had this error, it is because the gimp changed scheme interpreters in version 2.4 from SIOD to TinyScheme. I think that I may have fixed it in the attached script, it still gives warnings but the image is still created correctly. This is my first time fixing a bug, so I'm sorry if this isn't the correct way to submit this.

Revision history for this message
Tom Davidson (tjd-mit) wrote :

Thanks for the patch! perhaps Aaron can consider it for inclusion, or reassign it to the appropriate person?

Changed in inkscape:
assignee: nobody → acspike
Revision history for this message
Tom Davidson (tjd-mit) wrote :

Milestoning so that a dev will review the patch

Changed in inkscape:
importance: Low → Medium
milestone: none → 0.46
Revision history for this message
Aaron C Spike (acspike) wrote :

PsychoAlienDog,
Thanks for the fix. Its best to submit a diff against the latest version of svn. I've gone back in the svn history and diffed your script against the version that looks closest. Could you please look the diff over and explain your changes. If you are willing you could even grab the latest version of this script from svn and work to update that version.

http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/gimp_xcf.py?view=log

Would it be possible to make this script operate with new and old gimp?

The diff follows:

--- /home/aaron/Desktop/gimp_xcf_oldold.py 2008-02-10 14:46:52.000000000 -0600
+++ /home/aaron/Desktop/gimp_xcf_new.py 2008-02-10 14:41:55.000000000 -0600
@@ -48,6 +48,7 @@
         filelist = '"%s"' % '" "'.join(pngs)
         xcf = os.path.join(tmp_dir, "%s.xcf" % docname)
         script_fu = """
+(tracing 1)
 (define
   (png-to-layer img png_filename)
   (let*
@@ -56,6 +57,7 @@
       (png_layer (car (gimp-image-get-active-layer png)))
       (xcf_layer (car (gimp-layer-new-from-drawable png_layer img)))
     )
+
     (gimp-image-add-layer img xcf_layer -1)
     (gimp-drawable-set-name xcf_layer png_filename)
   )
@@ -66,11 +68,11 @@
   )
   (gimp-image-undo-disable img)
   (let* ((filelist '(%s)))
- (while filelist
- (let* ((filename (car filelist)))
- (png-to-layer img filename)
+ (for-each
+ (lambda (filename)
+ (png-to-layer img filename)
       )
- (set! filelist (cdr filelist))
+ filelist
     )
   )
   (gimp-image-resize-to-layers img)
@@ -89,4 +91,4 @@
         x.close()

 e = MyEffect()
-e.affect()
\ No newline at end of file
+e.affect()

Revision history for this message
Aaron C Spike (acspike) wrote :

ok, I think I've got a working script in svn now. Tom, can you try it? (In my tests inkscape crashes but the tempfile created by the script is correct. The inkscape crash is a new bug)

Revision history for this message
Bryce Harrington (bryce) wrote :

Any word so far on this? I know Kees recently modified how tempfiles are handled - perhaps that took care of the crash?

Revision history for this message
Aaron C Spike (acspike) wrote : Re: [Bug 168277] Re: Save as xcf results in empty file on gentoo linux

Bryce Harrington wrote:
> Any word so far on this? I know Kees recently modified how tempfiles
> are handled - perhaps that took care of the crash?

r17396 still crashes.

Revision history for this message
Aaron C Spike (acspike) wrote :

crash should be fixed now as of 17422

Changed in inkscape:
status: Confirmed → Fix Committed
Revision history for this message
Tom Davidson (tjd-mit) wrote :

Another one down! Works great under Fedora 8 in SVN rev 17424. Test SVG had linked images, which worked well...

Changed in inkscape:
status: Fix Committed → Fix Released
su_v (suv-lp)
tags: added: xcf
removed: extensions
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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