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 163479 - SOTA Chrome Error
SOTA Chrome Error
Status: RESOLVED WONTFIX
Product: GIMP
Classification: Other
Component: Script-Fu
2.2.x
Other Linux
: Normal trivial
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-01-09 18:43 UTC by James
Modified: 2008-01-15 12:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
A file containing Scheme-based wrappers for two gimp-text-* routines. (736 bytes, text/plain)
2005-03-07 19:27 UTC, Kevin Cozens
Details

Description James 2005-01-09 18:43:19 UTC
If you leave the text field open, you will get this GIMP Message:
SOTA Chrome Message
Error while executing
(script-fu-sota-chrome-logo -60 -47 0.75 "" 1000 "RoostHeavy"
"/usr/share/gimp/2.0/scripts/images/beavis.jpg" '(211 95 0) '(0 0 0))
ERROR: Procedural database execution failed:
    (gimp_drawable_width -1)
 
To make GIMP more usuable for new/unexperience users, it should just say the
text field is blank.
Comment 1 Sven Neumann 2005-01-09 19:21:47 UTC
You probably meant to write "If you leave the text field empty ...".

I don't think it's surprising that the Logo scripts don't work without any text,
but sure, the script (and many others) could check the return value and abort
with a reasonable error message.
Comment 2 Kevin Cozens 2005-01-09 20:36:12 UTC
A quick check with grep indicates there are about 77 scripts (all the main logo
scripts?) which have this problem.
Comment 3 James 2005-01-09 20:59:19 UTC
yah, it just makes things more usuable for new users.
Comment 4 Alan Horkan 2005-02-09 15:53:14 UTC
might be better to run using the default string rather than failing if the user
doesn't provide any text.  
Kevin, do you have an idea how to do this all in one go or do you think it will
probably require improving each script individually?  

[I think at this statge SOTA Chrome (State of the Art) is a bit of a misnomer.
Acronyms suck.]  
Comment 5 Sven Neumann 2005-02-10 14:43:13 UTC
Sure, let's rename SOTA Chrome in the menus.
Comment 6 Kevin Cozens 2005-02-13 06:43:28 UTC
The scripts should really be changed to handle the fact that some calls to PDB
functions could fail. In Tiny-Fu this could be done by using try/catch but in
Script-Fu I think you would just have to test the string before calling a
gimp-text function. A global "solution" could be used as a stop-gap measure.

Using a default string would just hide an incorrect call to the gimp-text
functions. Sven suggested checking to see if gimp-text was called with a
zero-length string when an error but that won't work since the gimp-text
routines don't return an execution error when passed a zero-length string. So
instead of the script aborting if it isn't set up to handle the error, something
else in the script will fail due to an earlier bad call to a gimp-text routines. 

I think the only other way to handle the problem is to use a Scheme based
wrapper for the gimp-text routines. When calling a gimp-text routine, instead of
calling the marshalling code right away, some extra Scheme code would perform a
test on the text string before calling the marshalling code. This wrapper would
spit out a message alerting the user to the bad call and could also abort the
script.
Comment 7 Kevin Cozens 2005-03-07 19:27:23 UTC
Created attachment 38382 [details]
A file containing Scheme-based wrappers for two gimp-text-* routines.

The attached file contains Scheme-based wrappers for gimp-text-fontname and
gimp-text-get-extents-fontname to be used with Script-Fu. Any time either of
these routines is called in a script the wrapper function gets used. The
wrapper then tests the passed string to see if it is empty. If it is, a warning
message is displayed before passing the call to GIMP.

The wrappers won't abort a script if an empty string is passed but, since the
script is probably going to die later on when a call is made to get the width
or height of the new layer. The user is alerted to the fact they are doing
something they probably shouldn't be doing.

These wrappers avoid the need to make changes to any of the 77 or so scripts
which would otherwise need to be changed to fix the reported problem.
Comment 8 Kevin Cozens 2005-03-07 19:30:09 UTC
I should also point out (in case it isn't obvious) that for the attached script
to work, it only needs to be copied to one of the directories which usually
holds Script-Fu scripts.
Comment 9 Sven Neumann 2005-03-07 20:14:14 UTC
How can this avoid changing the scripts? If you transparently wrap gimp-text-*,
you are effectively changing the call in a not backward-compatible way. Any
script that correctly checked the return value would then cause a useless and
annoying warning to appear.
Comment 10 Sven Neumann 2005-03-07 20:23:47 UTC
The only way I see to fix this issue would be to provide wrappers that the
scripts can call (script-fu-text-fontname and
script-fu-text-get-extents-fontname). These wrappers would have to be documented
and need to provide translated error messages. All our scripts would then have
to ported to these new functions. I don't think this is worth the effort; let's
close this report as WONTFIX and concentrate on providing a next text API that
doesn't have this flaw.