GNOME Bugzilla – Bug 512105
recent Script-Fu changes break lots of scripts
Last modified: 2008-09-24 21:48:42 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.
Created attachment 103745 [details] [review]
changes applied in gimp-2-4 that break script compatibility
This is the change that has been applied with the following ChangeLog entry:
2007-12-19 Kevin Cozens <email@example.com>
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.
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.
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 <firstname.lastname@example.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.
OK, thanks. Moving to the 2.6 milestone then.
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?
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.
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.
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.
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 <email@example.com>
(Miscellaneous/Backwards Compatibility): Replaced with a much
better text by Kevin Cozens containing for example sample code.
I don't think such a note fits into the README. Having it in the release notes should be good enough. Closing as WONTFIX.