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 691638 - item_get_attributes_sync introspection is broken
item_get_attributes_sync introspection is broken
Status: RESOLVED OBSOLETE
Product: libgnome-keyring
Classification: Core
Component: General
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME keyring maintainer(s)
GNOME keyring maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-01-13 03:35 UTC by Cole Robinson
Modified: 2021-06-18 13:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix introspection of item_get_attributes_sync (1.46 KB, patch)
2013-01-13 03:35 UTC, Cole Robinson
none Details | Review

Description Cole Robinson 2013-01-13 03:35:37 UTC
Via introspected python bindings at least, item_get_attributes_sync is
broken. It kinda works but crashes hard with a double free.

Patch adds annotations that make it work, but it might be breaking the
abstraction a bit by specifically labelling the AttributeList as a GArray.
Comment 1 Cole Robinson 2013-01-13 03:35:39 UTC
Created attachment 233361 [details] [review]
Fix introspection of item_get_attributes_sync

These annotations make this API functional for me via python, however
behavior is a bit inconsistent: it will return a python list() of
Attributes, while GnomeKeyring.attribute_list_new() will return a GArray.
Comment 2 Stef Walter 2013-01-13 08:21:24 UTC
Can we make GnomeKeyringAttributeList always map to list types in introspected languages? Can we do this without breaking API? Evan, what do you think is the right way to solve this.
Comment 3 Evan Nemerson 2013-01-13 10:48:11 UTC
(In reply to comment #2)
> Can we make GnomeKeyringAttributeList always map to list types in introspected
> languages?

Unfortunately not automatically.  Bug #629682.  It would have to be done for each argument.

> Can we do this without breaking API? Evan, what do you think is the
> right way to solve this.

In order to avoid breaking the Vala API we would need to basically reverse the proposed changes in the metadata file...  something like this should do the trick:

  item_get_attributes_sync.attributes type="GnomeKeyring.AttributeList"

Of course it doesn't really make sense to change this one function and leave all the other functions with GnomeKeyringAttributeList arguments.  If you want I can put together a patch later this week (Thursday or Friday probably).
Comment 4 Stef Walter 2013-01-14 14:56:40 UTC
Well I don't really care what's implemented, as long as it's consistent with the other uses of the attribute list.

Can we now just mark @attributes as (out)? Does GI scanner still crash when we do this (if so, can we fix it).

Evan, yes a patch would be nice, thanks.
Comment 5 Cole Robinson 2013-01-14 15:01:00 UTC
g-ir-scanner still crashes:

Traceback (most recent call last):
  • File "/usr/bin/g-ir-scanner", line 46 in <module>
    sys.exit(scanner_main(sys.argv))
  • File "/usr/lib64/gobject-introspection/giscanner/scannermain.py", line 428 in scanner_main
    main.transform()
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 76 in transform
    self._namespace.walk(self._pass_read_annotations)
  • File "/usr/lib64/gobject-introspection/giscanner/ast.py", line 457 in walk
    node.walk(callback, [])
  • File "/usr/lib64/gobject-introspection/giscanner/ast.py", line 534 in walk
    res = callback(self, chain)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 212 in _pass_read_annotations
    self._apply_annotations_function(node, chain)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 172 in _apply_annotations_function
    self._apply_annotations_callable(node, chain, block)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 737 in _apply_annotations_callable
    self._apply_annotations_params(node, node.parameters, block)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 706 in _apply_annotations_params
    self._apply_annotations_param(parent, param, tag)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 688 in _apply_annotations_param
    self._apply_annotations_param_ret_common(parent, param, tag)
  • File "/usr/lib64/gobject-introspection/giscanner/maintransformer.py", line 554 in _apply_annotations_param_ret_common
    target = self._transformer.resolve_aliases(target)
  • File "/usr/lib64/gobject-introspection/giscanner/transformer.py", line 964 in resolve_aliases
    typenode = ast.type_names[typenode.target.target_fundamental]
KeyError: '<array>'


I poked at it a bit but didn't understand what is going on.
Comment 6 Stef Walter 2013-01-14 15:06:20 UTC
Colin may have an idea why it's crashing. Colin, to reproduce this, we just use libgnome-keyring from git master and apply the following change:

--- a/library/gnome-keyring.c
+++ b/library/gnome-keyring.c
@@ -3893,3 +3893,3 @@ gnome_keyring_item_get_attributes (const char             
  * @id: The id of the item
- * @attributes: The location to return a pointer to the attribute list.
+ * @attributes: (out): The location to return a pointer to the attribute list.
  *
Comment 7 Colin Walters 2013-01-14 15:44:58 UTC
Typedefs for container types are basically just not supported right now, as Evan said in Comment 3.
Comment 8 Cole Robinson 2013-01-30 17:24:12 UTC
So I tried:

  @attributes: (out) (type GnomeKeyring.AttributeList)

and

  @attributes: (out) (element-type GnomeKeyringAttribute) (type GnomeKeyring.AttributeList)

g-ir-scanner crashes as above.

Doing just

  @attributes: (type GnomeKeyring.AttributeList)

Doesn't fix things with the python bindings: it still wants an attributelist passed to item_get_attributes_sync which isn't ever going to work.

Evan, any thoughts?
Comment 9 André Klapper 2021-06-18 13:52:46 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version of libgnome-keyring, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libgnome-keyring/-/issues/

Thank you for your understanding and your help.