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 633958 - Allow None where NULL is allowed in C API for method gnomekeyring.unlock_sync()
Allow None where NULL is allowed in C API for method gnomekeyring.unlock_sync()
Status: RESOLVED WONTFIX
Product: gnome-python-desktop
Classification: Deprecated
Component: general
2.32.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
gnome[unmaintained]
: 686672 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-11-03 23:47 UTC by Pa_trick17
Modified: 2014-08-02 13:02 UTC
See Also:
GNOME target: ---
GNOME version: 2.31/2.32


Attachments
Patch to fix the bug (914 bytes, patch)
2011-11-23 20:43 UTC, Bryan Hunt
none Details | Review
Patch to fix the bug v2 (better description/username) (826 bytes, patch)
2011-11-24 16:22 UTC, Bryan Hunt
none Details | Review
Fix suppressed password prompt by allowing a null password (1.04 KB, patch)
2011-12-23 21:09 UTC, Stef Walter
none Details | Review

Description Pa_trick17 2010-11-03 23:47:15 UTC
Seems as if the gnomekeyring.unlock_sync()-method was missing when fixing Bug 460518 ( https://bugzilla.gnome.org/show_bug.cgi?id=460518 ):

Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gnomekeyring
>>> gnomekeyring.lock_sync('login')
>>> gnomekeyring.unlock_sync('login')
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
TypeError: Required argument 'password' (pos 2) not found
>>> gnomekeyring.unlock_sync('login', None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unlock_sync() argument 2 must be string, not None
Comment 1 Pa_trick17 2010-11-04 01:24:48 UTC
Sorry for the confusion, but the GNOME-version is 2.32 and the gnomekeyring-version is 2.30. I hope I've set it right now for this (first bugzilla) report. :-)
Comment 2 Bryan Hunt 2011-06-10 09:04:43 UTC
My diff'ing patching skills are pretty lame but I've fixed this bug locally and reported it to Ubuntu (who seem to be just sitting on it).

The fix is: 

diff ./gnomekeyring/gnomekeyring.defs ./gnomekeyring/gnomekeyring.defs.orig
272c272
< '("const-char*" "password" (null-ok))
---
> '("const-char*" "password") 

The Ubuntu bug report which details stuff in much more detail is here:

https://bugs.launchpad.net/ubuntu/+source/gnome-python-desktop/+bug/432882

Should take all of 2 minutes to fix this bug.
Comment 3 Bryan Hunt 2011-11-23 20:43:21 UTC
Created attachment 202025 [details] [review]
Patch to fix the bug

My first ever Gnome patch. Yay!
Comment 4 Stef Walter 2011-11-23 21:52:54 UTC
Could you provide a small test program, so I can easily check before/after behavior?
Comment 5 Pa_trick17 2011-11-24 11:30:32 UTC
@ Stef Walter:

You can take the commandline-tests in my original bug-description or type in this one-liner in your commandline:

python -c "import gnomekeyring; defaultKeyring = gnomekeyring.get_default_keyring_sync(); gnomekeyring.unlock_sync(defaultKeyring, None)"

Before behavior was and is this Python-Traceback:
Traceback (most recent call last):
  • File "<string>", line 1 in <module>
TypeError: unlock_sync() argument 2 must be string, not None

Expected behavior is unlock your (previously locked if unlocked ;-) ) default-keyring.

Would be great if you can confirm and merge this patch that it hopefully soon can be shiped. Thank you very much for approaching!

@ Bryan Hunt: Yay! :-D Thank you so much!!!

Cheers,

Patrick
Comment 6 Stef Walter 2011-11-24 15:00:06 UTC
Thanks Bryan. Congratulations on your first contribution.

Could you format the git commit message (use 'git commit --amend') to be similar to the other messages in the log. In particular could you include a full email address, and change the commit message to look something like:

    gnomekeyring: A short one line description of fix

    Optional paragraph describing detail

    https://bugzilla.gnome.org/ Bugzilla URL

But, more importantly for some reason this doesn't seem to fix the problem for me:

$ git log
commit 9c8df4d5faabf6b8ea8f7d01a7f4d5bf1026dc53
Author: bryan <bryan@catah.(none)>
Date:   Wed Nov 23 20:37:31 2011 +0000

    Created a fix for gnome buzilla issue #633958.Allow null password, this will trigger the safer system password prompt - rathe
...

$ ls -l /data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
-rwxr-xr-x 1 stef stef 114047 Nov 24 15:54 /data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
$ python
Python 2.7.2 (default, Oct 27 2011, 01:40:22) 
[GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gnomekeyring
>>> print gnomekeyring.__file__
/data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
>>> defaultKeyring = gnomekeyring.get_default_keyring_sync(); gnomekeyring.unlock_sync(defaultKeyring, None)
Traceback (most recent call last):
  • File "<stdin>", line 1 in <module>
TypeError: unlock_sync() argument 2 must be string, not None
>>> 

Any ideas on how to get it to work. It seems that the fix is being built in, and the rebuilt module being loaded by python, but for some reason I still see the same problem.
Comment 7 Pa_trick17 2011-11-24 16:11:27 UTC
Hi.

Stef, can you please also check this patch by "dtk":
http://bugzilla-attachments.gnome.org/attachment.cgi?id=199841

found here:
https://bugzilla.gnome.org/show_bug.cgi?id=460518#c9

I'm not into git, so I can't check. :-( Sorry.

Patrick
Comment 8 Bryan Hunt 2011-11-24 16:22:33 UTC
Created attachment 202067 [details] [review]
Patch to fix the bug v2 (better description/username)
Comment 9 Bryan Hunt 2011-11-24 17:20:42 UTC
> But, more importantly for some reason this doesn't seem to fix the problem for
> me:
> 
> $ git log
> commit 9c8df4d5faabf6b8ea8f7d01a7f4d5bf1026dc53
> Author: bryan <bryan@catah.(none)>
> Date:   Wed Nov 23 20:37:31 2011 +0000
> 
>     Created a fix for gnome buzilla issue #633958.Allow null password, this
> will trigger the safer system password prompt - rathe
> ...
> 
> $ ls -l /data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
> -rwxr-xr-x 1 stef stef 114047 Nov 24 15:54
> /data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
> $ python
> Python 2.7.2 (default, Oct 27 2011, 01:40:22) 
> [GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import gnomekeyring
> >>> print gnomekeyring.__file__
> /data/build/gnome/lib64/python2.7/site-packages/gtk-2.0/gnomekeyring.so
> >>> defaultKeyring = gnomekeyring.get_default_keyring_sync(); gnomekeyring.unlock_sync(defaultKeyring, None)
> Traceback (most recent call last):
> 

Steps I took to check it locally:

sudo apt-get install libtool
libtoolize --force
aclocal
autoheader
touch ./ChangeLog
automake --force-missing --add-missing
autoconf
sudo apt-get install python-gtk2-dev python-gtk2
./configure
make
cd gnomekeyring
make gnomekeyring.c


The above produced for me the following content in the (generated) gnomekeyring.c file.

static PyObject *
_wrap_gnome_keyring_unlock_sync(PyObject *self, PyObject *args, PyObject *kwargs)
{
    static char *kwlist[] = { "keyring", "password", NULL };
    char *keyring, *password;
    GnomeKeyringResult ret;

    if (!PyArg_ParseTupleAndKeywords(args, kwargs,"zs:unlock_sync", kwlist, &keyring, &password))
        return NULL;
    pyg_begin_allow_threads;
    ret = gnome_keyring_unlock_sync(keyring, password);
    pyg_end_allow_threads;
    if (pygnomekeyring_result_check(ret))
        return NULL;
    Py_INCREF(Py_None);
    return Py_None;
}

const PyMethodDef pygnomekeyring_functions[] = {
    { "is_available", (PyCFunction)_wrap_gnome_keyring_is_available, METH_NOARGS,
      NULL },
    { "set_default_keyring_sync", (PyCFunction)_wrap_gnome_keyring_set_default_keyring_sync, METH_VARARGS|METH_KEYWORDS,
      NULL },
    { "get_default_keyring_sync", (PyCFunction)_wrap_gnome_keyring_get_default_keyring_sync, METH_NOARGS,
      NULL },
    { "list_keyring_names_sync", (PyCFunction)_wrap_gnome_keyring_list_keyring_names_sync, METH_NOARGS,
      NULL },
    { "lock_all_sync", (PyCFunction)_wrap_gnome_keyring_lock_all_sync, METH_NOARGS,
      NULL },
    { "create_sync", (PyCFunction)_wrap_gnome_keyring_create_sync, METH_VARARGS|METH_KEYWORDS,
      NULL },
    { "unlock_sync", (PyCFunction)_wrap_gnome_keyring_unlock_sync, METH_VARARGS|METH_KEYWORDS,
Comment 10 Stef Walter 2011-12-23 21:06:36 UTC
(In reply to comment #9)
>     if (!PyArg_ParseTupleAndKeywords(args, kwargs,"zs:unlock_sync", kwlist,
> &keyring, &password))

So shouldn't this line end up saying "zz:unlock_sync" instead?
Comment 11 Stef Walter 2011-12-23 21:09:43 UTC
Created attachment 204156 [details] [review]
Fix suppressed password prompt by allowing a null password
Comment 12 Stef Walter 2011-12-23 21:10:55 UTC
Looks like the patch was missing the code to update unlock_sync. 

And it turns out I can't push to gnome-python-desktop at all:

remote: A valid gnome-python-desktop.doap file is required. See http://live.gnome.org/MaintainersCorner#maintainers
To ssh://git.gnome.org/git/gnome-python-desktop
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'ssh://git.gnome.org/git/gnome-python-desktop'

Grumble. Seems like it really is utterly unmaintained, and I don't want to take over maintainership of the whole thing. Posted the updated patch here.
Comment 13 Stef Walter 2012-10-23 05:02:12 UTC
*** Bug 686672 has been marked as a duplicate of this bug. ***
Comment 14 Steven Johnson 2013-04-12 08:15:12 UTC
Although it seems this will never be fixed in this version, it is fixed in the new Python3 gobject introspection version. To start you off:

from gi.repository import GnomeKeyring


keyring=None # Keyring name
GnomeKeyring.unlock_sync(keyring, None) # Works!

I'm not affiliated with any development team, just a hobbyist.
Comment 15 André Klapper 2014-08-02 13:02:26 UTC
The last gnome-python-desktop code changes took place in January 2011:
https://git.gnome.org/browse/archive/gnome-python-desktop/log/

This project is not under active development anymore.

This project got recently archived in GNOME Git.

It is currently unlikely that there will be any further active development.

Closing this report as WONTFIX as part of Bugzilla Housekeeping to reflect reality. Please feel free to reopen this bug report in the future if anyone takes the responsibility for active development again. If you are interested in maintainership, inform https://mail.gnome.org/mailman/listinfo/desktop-devel-list

gnome-python-desktop wrapped application API in GNOME 2. For Python in GNOME 3, see https://wiki.gnome.org/Projects/PyGObject and its gobject-introspection approach.