Bug 490143

Summary: ibus issue with gnome-keyring
Product: [Fedora] Fedora Reporter: Matthias Clasen <mclasen>
Component: ibusAssignee: Peng Huang <phuang>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: dcantrell, i18n-bugs, petersen, phuang, tbzatek, walters
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-11 16:52:49 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 446452    

Description Matthias Clasen 2009-03-13 14:45:13 UTC
I spotted the following in the logs:

Mar 13 09:40:15 localhost gnome-keyring-ask: IBUS: Connect to unix:path=/tmp/ibus-(null)/ibus--0.0 failed. In D-Bus address, character '(' should have been escaped#012.


Looks like ibus fails to get the username when used in the gnome-keyring password dialog.

Looking at ibus_get_user_name(), it is no wonder...

Comment 1 Matthias Clasen 2009-03-13 15:35:56 UTC
Some further hints from Ray:

- should ideally just use an abstract socket

- definitively don't use the hostname in the socket name, since it is not something thats stable over time and can be relied on (NM sets it dynamically)

Comment 2 Peng Huang 2009-03-28 02:48:09 UTC
Hi Matthias,
Please tell me how to use /usr/libexec/gnome-keyring-ask, and then I could debug it, and find a right way to get user name in gnome-keyring-ask

Why I use user name in socket address instead of use random named abstract socket? It is because of below reasons:
1. ibus-daemon is not started before all applications. So It can not tell client applications the address name via an env variable like $DBUS_SESSION_BUS_ADDRESS.
2. ibus has a feature: The ibus-daemon can be stopped and re-started in any time. So we should have a method to let im modules can be notified when the daemon is executed. Currently, im modules will watch the folder /tmp/ibus-$USERNAME/ by inotify, and receive notify when socket file is created or removed. I don't know another better methods.

Do you have some suggestions?

Comment 3 Matthias Clasen 2009-03-28 03:22:51 UTC
gnome-keyring-ask is the dialog that comes up to unlock your keyring.

Not sure about about the abstract socket then, but the point about the hostname still stands. 

Wrt to the user name, this commit will improve things in the next release:

2009-03-16 Stef Walter <stef>
 	
 	* library/gnome-keyring-utils.c: Set USERNAME
 	and LOGNAME environment variables in daemon when
 	starting up. Fixes bug #575262. Reported by Matthias Clasen

Comment 4 Peng Huang 2009-03-29 06:06:00 UTC
Great!
So I move this bug to gnome-keyring, and wait the next release.

Comment 5 Matthias Clasen 2009-03-29 14:39:20 UTC
You still need to fix the hostname problem

Comment 6 Peng Huang 2009-03-30 02:27:26 UTC
Sorry. What's the hostname problem? Please give me some detail.

FYI:
The ibus session is bind to X session. Each X sessions will have a separated ibus. So the socket address includes some info from $DISPLAY env variable. 
For example:
DISPLAY=localhost:0.0, the address will be ibus-$USERNAME/ibus-localhost-0.0
DISPLAY=other_xserver_ip:0.0, the address will be ibus-$USERNAME/ibus-other_xserver_ip-0.0
DISPLAY=:0.0, the address will be ibus-$USERNAME/ibus--0.0

Comment 7 Matthias Clasen 2009-03-30 03:34:47 UTC
Ok, so you just use the hostname part of the DISPLAY.

There are still several problems here.

- You assume that $DISPLAY is set. While this is normally the case, it is by no means guaranteed. Example:

unset DISPLAY
gedit --display :1.0

- You assume that $DISPLAY is unique. But it is easy to come up with examples where different DISPLAY strings give you a connection to the same server, e.g.

localhost:0.0
unix:0.0
:0.0

- You say that your ibus server is bound to the X session, but your socket name depends on the screen that something is started on:

DISPLAY=:0.1 gedit # oops, no input methods on screen 1

Comment 8 Peng Huang 2009-03-30 05:59:47 UTC
I understood the problem now. Do have some suggestions? Do you know some better methods to get the unique information from the current X session (or X Server)?

BTW, I think the ibus socket address must include the hostname. If the Xserver is running on different host, host name is important to distinguish the sessions with other Xserver running on different hosts with same display number.

Comment 9 Peng Huang 2009-03-31 04:29:48 UTC
I tried fixed this issue by follow ways.
1. Remove screen number from socket address
2. Get the DISPLAY from gdk_display_get_name
3. If the hostname in DISPLAY is empty. I will use unix as hostname

Modified in  ibus-1.1.0.20090331-1

Please try it.

Comment 10 Jesse Keating 2009-05-11 16:52:49 UTC
mclasen says it can be closed now.