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 667985 - g-ir-scanner crashes with KeyError on aliased (out) arguments
g-ir-scanner crashes with KeyError on aliased (out) arguments
Status: RESOLVED OBSOLETE
Product: gobject-introspection
Classification: Platform
Component: g-ir-scanner
2.31.x
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2012-01-16 07:39 UTC by Martin Pitt
Modified: 2018-02-08 12:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Test header showing problem (997 bytes, text/x-chdr)
2014-08-20 00:22 UTC, Simon Feltman
Details

Description Martin Pitt 2012-01-16 07:39:51 UTC
While developing GI support for gnome-keyring in bug 598414 I stumbled over a crash in the scanner when trying to annotate a function with an "out" argument which is a typedef for a GArray:

  typedef GArray GnomeKeyringAttributeList;


/**
 * gnome_keyring_item_get_attributes_sync:
 * @keyring: (allow-none): The name of the keyring in which the item exists, or
 *           %NULL for the default keyring.
 * @id: The id of the item
 * @attributes: (out): The location to return a pointer to the attribute list.
 *
 * Get all attributes for an item.
 *
 * A #GnomeKeyringAttributeList will be returned in @attributes. This should be
 * freed using gnome_keyring_attribute_list_free().
 *
 * For an asynchronous version of this function see gnome_keyring_item_get_attributes().
 *
 * Return value: %GNOME_KEYRING_RESULT_OK if the operation was succcessful or
 * an error result otherwise.
 **/
GnomeKeyringResult
gnome_keyring_item_get_attributes_sync (const char                 *keyring,
                                        guint32                     id,
                                        GnomeKeyringAttributeList **attributes)


When I added the (out), g-ir-scanner crashes:

  GISCAN GnomeKeyring-1.0.gir
Traceback (most recent call last):
  • File "/usr/bin/g-ir-scanner", line 46 in <module>
    sys.exit(scanner_main(sys.argv))
  • File "/usr/lib/gobject-introspection/giscanner/scannermain.py", line 427 in scanner_main
    main.transform()
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 75 in transform
    self._namespace.walk(self._pass_read_annotations)
  • File "/usr/lib/gobject-introspection/giscanner/ast.py", line 454 in walk
    node.walk(callback, [])
  • File "/usr/lib/gobject-introspection/giscanner/ast.py", line 530 in walk
    res = callback(self, chain)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 211 in _pass_read_annotations
    self._apply_annotations_function(node, chain)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 171 in _apply_annotations_function
    self._apply_annotations_callable(node, chain, block)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 722 in _apply_annotations_callable
    self._apply_annotations_params(node, node.parameters, block)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 694 in _apply_annotations_params
    self._apply_annotations_param(parent, param, tag)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 676 in _apply_annotations_param
    self._apply_annotations_param_ret_common(parent, param, tag)
  • File "/usr/lib/gobject-introspection/giscanner/maintransformer.py", line 552 in _apply_annotations_param_ret_common
    target = self._transformer.resolve_aliases(target)
  • File "/usr/lib/gobject-introspection/giscanner/transformer.py", line 893 in resolve_aliases
    typenode = ast.type_names[typenode.target.target_fundamental]
KeyError: '<array>'

Comment 1 Simon Feltman 2014-08-20 00:22:29 UTC
Created attachment 283942 [details]
Test header showing problem

Seems like the API in question is gone at this point. But the problem mentioned still exists when doing a basic test. In any event, a workaround might be to explicitly annotate the type.

 * @attributes: (out) (type GArray) (element-type int):


Compile test header with:

g-ir-scanner --warn-all --warn-error --reparse-validate \
	--namespace=Test \
	--nsversion=1.0 \
	--header-only \
	--include=GLib-2.0 \
	--cflags-begin `pkg-config gobject-2.0 --cflags` --cflags-end \
	--output=Test-1.0.gir test.h
Comment 2 André Klapper 2015-02-07 17:11:27 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]
Comment 3 GNOME Infrastructure Team 2018-02-08 12:13:20 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gobject-introspection/issues/62.