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 168290 - aset not working when using string arrays
aset not working when using string arrays
Status: RESOLVED NOTABUG
Product: GIMP
Classification: Other
Component: Script-Fu
2.2.x
Other All
: Urgent critical
: ---
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks: 317634
 
 
Reported: 2005-02-23 17:49 UTC by Kent Loobey
Modified: 2008-01-15 12:48 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kent Loobey 2005-02-23 17:49:48 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.
Comment 1 Simon Budig 2005-02-23 21:41:48 UTC
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.
Comment 2 Sven Neumann 2005-02-23 23:25:32 UTC
Reopening on request of Kevin.
Comment 3 Kevin Cozens 2005-02-23 23:35:53 UTC
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.
Comment 4 Kent Loobey 2005-02-24 17:39:57 UTC
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)
Comment 5 Kevin Cozens 2005-02-25 21:39:48 UTC
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.
Comment 6 Kevin Cozens 2005-02-26 18:11:16 UTC
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.
Comment 7 Kevin Cozens 2005-03-01 06:22:53 UTC
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.
Comment 8 Michael Natterer 2005-03-05 01:00:28 UTC
Closing as FIXED then.
Comment 9 Michael Natterer 2005-09-30 19:03:33 UTC
Reopening because this breaks all users of string arrays. We must
stay compatible with 2.2, even if it means staying compatible with
inconsistencies.
Comment 10 Sven Neumann 2005-10-05 11:23:30 UTC
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).
Comment 11 Kevin Cozens 2005-11-09 19:05:49 UTC
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.