GNOME Bugzilla – Bug 168290
aset not working when using string arrays
Last modified: 2008-01-15 12:48:39 UTC
Please describe the problem: "aset" produces an error when trying to assign a string to a cons-array variable. Example: (let ( (foo (cons-array 1 'byte)) ) (aset foo 0 "my string") ) Resulting error message: 4 Specify button linkage Message Error while executing (script-fu-damenu-specify-button-linkage 1 6 "This Button" "up-button" "down-button" "left-button" "right-button") ERROR: bad value to store in array (errobj my string) Steps to reproduce: 1. Create a Script-Fu script 2. Assign a string to a string array with aset 3. Invoke the script Actual results: Script-Fu displays an error message Expected results: The string would get assigned to the array variable Does this happen every time? Yes. Other information: No.
No surprise here. If you create an array of *bytes* and try to assign a string to an element of the array it of course has to fail. I wonder what you expected here. An array of bytes certainly is not a string array. Closing as NOTABUG.
Reopening on request of Kevin.
This was first reported on the gimp-devel mailing list. The original report showed the use of 'string in the cons-array call. The call showing 'byte above is a typo. I have looked at the string array handling code in SIOD and from what I can see it is seriouly broken. The problem affects all of the array related calls where a string array is involved. I have fixed cons-array in my source tree but there are several other places that need fixing.
Sorry. The original message should have been: Example: (let ( (foo (cons-array 1 'string)) ) (aset foo 0 "my string") ) Resulting error message: 4 Specify button linkage Message Error while executing (script-fu-damenu-specify-button-linkage 1 6 "This Button" "up-button" "down-button" "left-button" "right-button") ERROR: bad value to store in array (errobj my string)
2005-02-25 Kevin Cozens <kcozens@cvs.gimp.org> * plug-ins/script-fu/siod/siod.h * plug-ins/script-fu/siod/sliba.c: Creation and manipulation of string arrays was seriously broken. Fixes bug #168290.
The Scheme interpreter (SIOD) was modified to handle numeric arrays while string arrays were handled as a list of strings. To avoid confusion in Tiny-Fu, all array types are handled the same way (as arrays). The marshalling code of Script-Fu needs to be changed since it is still treats string arrays as a list of strings.
2005-03-01 Kevin Cozens <kcozens@cvs.gimp.org> * plug-ins/script-fu/siod-wrapper.c: Fixed marshalling code to treat string arrays as arrays instead of lists of strings. Last part of the fix for bug #168290. The two fixes for this bug could be backported to GIMP 2.2 but it would probably be an API change since it alters the way string arrays are handled. Since this hasn't been reported until now its probably not a big problem. GIMP 2.2 will treat string arrays as list of strings while in CVS GIMP and later they will be arrays just like the other PDB array types. This bug report can be closed as RESOLVED/FIXED.
Closing as FIXED then.
Reopening because this breaks all users of string arrays. We must stay compatible with 2.2, even if it means staying compatible with inconsistencies.
Reverted the incompatible changes. Closing again as FIXED. 2005-10-05 Sven Neumann <sven@gimp.org> * plug-ins/script-fu/siod-wrapper.c: reverted changes to handling of string arrays to stay backward compatible (see bug #168290 and bug #317634). * plug-ins/script-fu/scripts/font-map.scm: reverted change that was done to adapt to above changes (see bug #308681).
Reopening this bug because reverting the changes reinstated the originally reported problem. This report should either be closed as WONTFIX or placed on a target milestone of Future.