After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 626020 - Console window opening on file-ps-load
Console window opening on file-ps-load
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Plugins
2.6.6
Other Windows
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2010-08-04 12:41 UTC by sben1783
Modified: 2012-05-30 15:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description sben1783 2010-08-04 12:41:45 UTC
When using file-ps-load on WinXP from the script-fu console or from gimp batch-mode, there is a DOS-Box (cmd-window) popping up. It is empty and disappears without further user interaction. I think it's triggered by the call of gswin32c.exe. The call of file-ps-load itself works as expected, but the "pop-up" is very annoying when gimp is called in batch mode while your doing something else on the computer (like writing an email -> the mail editor window loses its focus every time file-ps-load is called in the background).

We discussed this on #gimp irc where schumaml guessed it might be related to the flags used here: http://git.gnome.org/browse/gimp/tree/plug-ins/common/file-ps.c#n1763 ff. (adding G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL?)
Comment 1 Sven Neumann 2010-08-04 18:13:46 UTC
That would most probably fix the problem. Please try this change and report back. Preferably attach a patch here.
Comment 2 sben1783 2010-08-04 18:35:58 UTC
I'm sorry... I *might* be able to somehow figure out how to change the code, but I'm definitly not able to compile Gimp on windows (using windows only at work, where I'm not allowed to install additional tools).
Comment 3 Tor Lillqvist 2010-08-05 06:39:09 UTC
Is't not a "DOS Box". It has nothing to do with (MS-)DOS. Just call it a "console window" which is the correct and meaningful term. Anyway no, I doubt using the flags mentioned will help. There currently is no way to avoid a console window when running an exe file marked as being a "console" executable using the g_spawn*() APIs. (There is a bug open that suggests adding a flag for that, but it has been slow to progress, partly I can take the blame for that.)

Instead, the code should perhaps run gswin32.exe and not gswin32c.exe, if there is a such, I don't have Ghostscript right now on my Windows machine to check. Can you check if I recall correctly, does Ghostscript also come with a gswin32.exe, and does the console window go away if you set the environment variable GS_PROG to gswin32.exe? (And make sure that too is found in PATH.) Although, there is a comment in the code that says "We want the console ghostscript application", so maybe that won't help, maybe gswin32.exe doesn't take command-line parameters as gswin32c.exe does.
Comment 4 Michael Schumacher 2010-08-05 07:49:58 UTC
Nevertheless, the g_spawn*() docs mention that these flags should be set if stdout and stderr are set to NULL.
Comment 5 sben1783 2010-08-06 16:44:41 UTC
@Tor: I tried using gswin32.exe. The call works as expected (so the command-line parameters seem to be the same for at least my use case), but there also is a window coming up. It's not a console window, but an all white window with "gswin32.exe" (or without the .exe?) as its title. This window also disappears without user interaction.
As such, using gswin32.exe doesn't really improve things, but maybe for this exe the flags would help (just a guess, not really understanding what's going on behind the scenes...)?
(In reply to comment #3)
Comment 6 Michael Schumacher 2010-08-12 19:57:54 UTC
commit fe7b253512a9286aa6ff6b24c873fa5d27342be7
Author: Michael Schumacher <schumaml@gmx.de>
Date:   Thu Aug 12 21:40:40 2010 +0200

    Bug 626020 - Console window opening on file-ps-load
    
    Added G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL to the
    g_spawn_sync () flags. According to Tor Lillqvist this won't fix the bug,
    but the GLib docs state that these flags have to be added if stdout and
    stderr are set to NULL.
Comment 7 Michael Schumacher 2010-08-12 20:19:29 UTC
And for gimp-2-6 as well:

commit 608a680240eb4a10e718cdb4ac8e17e70c695312
Author: Michael Schumacher <schumaml@gmx.de>
Date:   Thu Aug 12 21:40:40 2010 +0200

    Bug 626020 - Console window opening on file-ps-load
    
    Added G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL to the
    g_spawn_sync () flags. According to Tor Lillqvist this won't fix the bug,
    but the GLib docs state that these flags have to be added if stdout and
    stderr are set to NULL.
Comment 8 Michael Natterer 2012-01-08 21:06:57 UTC
Please try GIMP 2.7.4 and report back, we won't fix 2.6 bugs any longer.
Comment 9 Akhil Laddha 2012-02-22 13:16:14 UTC
Could you please try to reproduce problem with GIMP 2.7.4 or later version and update the bug report with your findings, tia.
Comment 10 sben1783 2012-02-23 21:39:52 UTC
I'm really sorry, but I do not have a windows installation of gimp 2.7.4 or later available. As mentioned above, I'm using windows only at work and as of today, they only have gimp 2.6.6 installed:(
There was no special environment needed to reproduce the bug, so maybe somebody with a windows environment (that he has admin rights for) can try to reproduce it with 2.6 and confirm solution with 2.7.4?
Comment 11 tobias 2012-02-24 13:16:48 UTC
I think this should be tested with an version newer then 2.7.4, because the move to libgv was after the 2.7.4 release.
I'm not able to compile Gimp on Windows, but if someone could point me to a setup with the changes to libgv, I could test it.
Comment 12 tobias 2012-03-15 09:21:46 UTC
I've tried to test it with 2.7.5 (Windows 7), but I'm not sure if this bug is fixed because in the developer versions is always an console window open.
Comment 13 tobias 2012-04-20 11:04:51 UTC
Opening PS-Files with the file open dialogue, I don't get a console window. What do I need to enter in the script-fu console to test this?
Comment 14 sben1783 2012-04-26 20:38:16 UTC
The following should create a png file from your postscript and pop up the console window:

(begin (define infile  "c:\path\to\picture.ps")
(define outfile "c:\path\to\picture.png") (file-ps-load-setargs 200 0 0 1 "1" 6 4 4)  (let* ( (img (car (file-ps-load 1 infile infile))) (drw (car (gimp-image-active-drawable img)))) (file-png-save 1 img drw outfile outfile 0 1 0 0 0 0 0)))

I got a new PC at work and was not able to test this again because GIMP said it couldn't start gswin32c.exe even though %GS_PROG% is set and valid. I verified the syntax here at home with gimp 2.6.8 (linux).
Comment 15 Michael Schumacher 2012-05-28 11:14:30 UTC
Now that there is a 2.8.0, this can be tested without the standard console window of the development versions.
Comment 16 tobias 2012-05-30 14:18:04 UTC
I've tested it with Gimp 2.8.0 on my Windows 7 system and I haven't seen any console window. I think we can close this bug as fixed.