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 512105 - recent Script-Fu changes break lots of scripts
recent Script-Fu changes break lots of scripts
Status: RESOLVED WONTFIX
Product: GIMP
Classification: Other
Component: Script-Fu
git master
Other All
: Normal major
: 2.6
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2008-01-25 18:32 UTC by Sven Neumann
Modified: 2008-09-24 21:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
changes applied in gimp-2-4 that break script compatibility (2.14 KB, patch)
2008-01-25 18:38 UTC, Sven Neumann
committed Details | Review

Description Sven Neumann 2008-01-25 18:32:52 UTC
+++ This bug was initially created as a clone of Bug #508020 +++

I should have opened a new bug report for this in the first place. Let's do this now and track and discuss the issue of breaking Script-Fu compatibility here.
Comment 1 Sven Neumann 2008-01-25 18:38:20 UTC
Created attachment 103745 [details] [review]
changes applied in gimp-2-4 that break script compatibility
Comment 2 Sven Neumann 2008-01-25 18:41:24 UTC
This is the change that has been applied with the following ChangeLog entry:

2007-12-19  Kevin Cozens  <kcozens@cvs.gnome.org>

        Merged from trunk:

        * plug-ins/script-fu/tinyscheme/scheme.c: Added extra checks to stop
        bad syntax in LET*, LET, and LETREC from causing a segmentation fault
        in Linux. See SourceForge bug #1817986.


As a side-effect it enforces R5RS syntax for 'let'. Quite a few scripts in GIMP had to be changed due to this. We should keep the changed scripts, of course, to serve as a good example. But I think it is not acceptable to break lots of scripts out there. In particular not in the middle of a stable release series. Thus I suggest that the change in scheme.c is reverted, at least in the gimp-2-4 branch.
Comment 3 Sven Neumann 2008-01-28 08:13:25 UTC
Kevin, what do you think should be done now? I would suggest that we revert the change in the 2.4 branch and keep this report open until we have found a better solution.
Comment 4 Kevin Cozens 2008-01-29 16:46:49 UTC
We don't seem to have any other option at the moment but reverting the change. A note should be added to the README, NEWS, and/or web site to let users know they may have copied examples of bad syntax when they updated their scripts. If they don't correct bad let syntax they may experience breakage in a later release of GIMP (depending on how this issue is finally resolved).

2008-01-29  Kevin Cozens  <kcozens@cvs.gnome.org>

        * plug-ins/script-fu/tinyscheme/scheme.c: Reverted changes that
        prevent a seg fault due to bad syntax in LET*, LET, and LETREC. 
        The change enforced R5RS syntax breaking scripts that used bad 
        syntax (missing values) when they were updated to GIMP 2.4.
Comment 5 Sven Neumann 2008-01-29 17:50:51 UTC
OK, thanks. Moving to the 2.6 milestone then.
Comment 6 Sven Neumann 2008-07-13 20:38:42 UTC
What's the current state on this? Do users get a helpful error message for scripts that don't follow the syntax correctly? Do we have an explanation that can be included in the release notes?
Comment 7 Kevin Cozens 2008-08-21 06:49:10 UTC
There has been no change to the Script-Fu plug-in to make it provide any warning or error message to the user if they use bad syntax in a let statement. I don't think it would be easy to provide any message to a user when the scripts are always passed RUN-NONINTERACTIVE. Since we can't break scripts at this time, all we can do is tell users that their scripts will break in the future if it uses a variable in a let block by itself without a value.
Comment 8 Sven Neumann 2008-08-21 18:52:39 UTC
Thanks Kevin. That was not helpful.

So to answer my questions myself I have done some tests. The changes have been reverted in the gimp-2-4 branch only, so starting with GIMP 2.6 scripts that use a variable in a let block will break. The error message due to such a syntax error looks something like this:

Error while executing
(script-fu-test-sphere 100 45 TRUE '(255 255 255) '(255 0 0) '("Circle (03)" 1 44 0) "Tiny-Fu rocks!" "Hello,\
World!" "Maple Leaves" "Deep Sea" FALSE "Agate" 50 "Default" "/usr/local/share/gimp/2.0/scripts/images/beavis.jpg" 0 1 "/var/tmp" -1 -1 -1 -1 -1)

Error: Bad syntax of binding spec in let* : ((foo) (width (* radius 3.75)) (height (* radius 2.5)) (img (car (gimp-image-new width height RGB))) (drawable (car (gimp-layer-new img width height RGB-IMAGE "Sphere Layer" 100 NORMAL-MODE))) (radians (/ (* light *pi*) 180)) (cx (/ width 2)) (cy (/ height 2)) (light-x (+ cx (* radius (* 0.6 (cos radians))))) (light-y (- cy (* radius (* 0.6 (sin radians))))) (light-end-x (+ cx (* radius (cos (+ *pi* radians))))) (light-end-y (- cy (* radius (sin (+ *pi* radians))))) (offset (* radius 0.1)) (text-extents (gimp-text-get-extents-fontname multi-text size PIXELS font)) (x-position (- cx (/ (car text-extents) 2))) (y-position (- cy (/ (cadr text-extents) 2))) (shadow-w 0) (shadow-x 0)) 

So there's an error message. Perhaps a little bit too verbose, but there's one. That is good.

Now what's missing here is a short paragraph that we can include in the README and the Release Notes for GIMP 2.6.
Comment 9 Martin Nordholts 2008-09-23 10:25:41 UTC
I have now added a better-than-nothing note about this in the release notes:

"""
There have been changes to Script-Fu that breaks scripts using invalid let-syntax. The reason for the change is to prevent a crash of Script-Fu. Please refer to Bug 512105 – recent Script-Fu changes break lots of scripts.
"""

It would certainly be good to improve this with for example sample code, but I leave that up to you guys.
Comment 10 Martin Nordholts 2008-09-23 20:09:46 UTC
Kevin gave me a text to put in the release notes, so now there's just a note about this in the README missing:

2008-09-23  Martin Nordholts  <martinn@svn.gnome.org>

	* release-notes/gimp-2.6.htrw
	(Miscellaneous/Backwards Compatibility): Replaced with a much
	better text by Kevin Cozens containing for example sample code.
Comment 11 Sven Neumann 2008-09-24 21:48:42 UTC
I don't think such a note fits into the README. Having it in the release notes should be good enough. Closing as WONTFIX.