Comment 2 for bug 207208

Revision history for this message
Alexey Nedilko (alexey.nedilko) wrote :

I can confirm this bug on Ubuntu 8.04.
The configuration is the following:

uname -a: Linux axe-desktop 2.6.24-18-generic #1 SMP Wed May 28 19:28:38 UTC 2008 x86_64 GNU/Linux

GNOME version: 2.22.2 (built on 03.06.2008 by Ubuntu)

Tomboy version: 0.10.2

mono --version:
Mono JIT compiler version 1.2.6 (tarball)
Copyright (C) 2002-2007 Novell, Inc and Contributors. www.mono-project.com
 TLS: __thread
 GC: Included Boehm (with typed GC)
 SIGSEGV: altstack
 Notifications: epoll
 Architecture: amd64
 Disabled: none

When setting the parameters for WebDAV synchronisation login, I get "Getting configuration from the GNOME keyring failed with the following message: Unknown error" message in .tomboy.log, and saving the settings fails with the message "Saving configuration to the GNOME keyring failed with the following message: Unknown error".

I downloaded the source code of Tomboy 0.10.2 and tried to find out, what was the reason for this error. It appeared that GNOME keyring returned the result code "9" for Find operation, and Tomboy code did not know how to interpret this value, thus throwing "Unknown error" exception.

I've looked into GNOME documentation for GNOME keyring API (http://library.gnome.org/devel/gnome-keyring/stable/gnome-keyring-gnome-keyring-result.html#GnomeKeyringResult) and saw that result codes are described by the following enum:
typedef enum {
 GNOME_KEYRING_RESULT_OK,
 GNOME_KEYRING_RESULT_DENIED,
 GNOME_KEYRING_RESULT_NO_KEYRING_DAEMON,
 GNOME_KEYRING_RESULT_ALREADY_UNLOCKED,
 GNOME_KEYRING_RESULT_NO_SUCH_KEYRING,
 GNOME_KEYRING_RESULT_BAD_ARGUMENTS,
 GNOME_KEYRING_RESULT_IO_ERROR,
 GNOME_KEYRING_RESULT_CANCELLED,
 GNOME_KEYRING_RESULT_KEYRING_ALREADY_EXISTS,
 GNOME_KEYRING_RESULT_NO_MATCH
} GnomeKeyringResult;

Comparing this declaration to the similar one in Tomboy code (Gnome.Keyring.ResultCode enum, defined in Tomboy/Gnome.Keyring/ResultCode.cs):
 public enum ResultCode {
  Ok,
  Denied,
  NoKeyringDaemon,
  AlreadyUnlocked,
  NoSuchKeyring,
  BadArguments,
  IOError,
  Cancelled,
  AlreadyExists
 }
one can see that the value NO_MATCH (ordinal 9) isn't present in Tomboy's ResultCode enumeration.

So the scenario that reproduces the bug is the following:
When showing the dialog page with WebDAV sychronization parameters, Tomboy tries to find the WebDAV credentials in GNOME keyring. If they aren't present there (and that's also the case when the WebDAV sychronization is set up for the first time), GNOME keyring returns NO_MATCH value, meaning "No such item is present in the keyring". Tomboy is unable to interpret the result code, since it's not present in Gnome.Keyring.ResultCode enum, and throws KeyringException with "Unknown error" message. When saving the credentials to the keyring, it calls the Find() operation again in order to determine, whether it should create a new keyring item or update the existing one. So the Find() operation throws again, and "Saving.... failed.." dialog box is shown.

Having found out this, I've prepared the patch that fixes the bug. The patch consists of two changes:
1) The value NoMatch (ordinal value 9) is added to Gnome.Keyring.ResultCode enumeration.
2) The Find() and FindNetworkPassword() methods of Gnome.Keyring.Ring class are made to return empty result, if the underlying SendRequest() method throws KeyringException with NoMatch result code.

Attached are two *.diff files containing the fixes I've made.

I could not find out directly, why this discrepancy in result codes appeared. However I assume this value, NO_MATCH, has been added recently (perhaps, in GNOME 2.22.2, because the bug is not reproducible on Ubuntu 7.10, GNOME 2.20), and Tomboy code wasn't updated accordingly.

Please review the fix I made, and apply it if it's feasible.

I've also posted the similar comment to this bug description on GNOME Bugzilla (http://bugzilla.gnome.org/show_bug.cgi?id=499841).