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 673964 - BadValue from XIQueryVersion in newer X servers
BadValue from XIQueryVersion in newer X servers
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gnome-settings-daemon-maint
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-04-12 04:23 UTC by Peter Hutterer
Modified: 2012-05-17 17:23 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Try-XI-2.2-if-XI-2.0-fails.patch (1.24 KB, patch)
2012-04-12 04:23 UTC, Peter Hutterer
committed Details | Review

Description Peter Hutterer 2012-04-12 04:23:04 UTC
Created attachment 211898 [details] [review]
0001-Try-XI-2.2-if-XI-2.0-fails.patch

The MediaKeys plug-in calls supports_xinput2_devices(). That again calls XIQueryDevice with a major/minor of 2.0. The upstream server has a check for this in place and responds BadValue if a client initiates XI2 twice with two different versions. This happens here, and thus the plugin fails to load.

The attached is a quickfix, but it's a sign of a larger problem. if libraries are nested, the first one to call XIQueryDevice can BadValue all other nested calls if they don't use the same version.

What can we do here?

Bug #673961 is the same problem, affecting clutter.
Comment 1 Bastien Nocera 2012-04-12 09:33:45 UTC
The very helpful description in the man page:
"           XIQueryVersion can generate a BadValue error."

I would think that this needs to be fixed in the X library. How is one to know that XIQueryVersion() was called with a different version?

Or we could just call it with "2.2" and sigh very heavily.
Comment 2 Peter Hutterer 2012-04-12 09:48:47 UTC
Right, the man page isn't useful and the actual error is a rather recent patch anyway. The problem was there beforehand already though: the server does adjust behaviour depending on the announced version, so if you have one client call it with different versions, whichever one was called last took over even though we told the client something else first.
Now the server actually does respond BadValue for this.

Tbh, I think the solution needs to be in the client. For example, the raw events behaviour changes between 2.0 and 2.1, so if a client calls XIQueryVersion with 2.0 and 2.2 the server can't know which behaviour to expose to the client.
Comment 3 Peter Hutterer 2012-04-23 05:47:25 UTC
Behaviour of the server will be that the first call to XIQueryVersion() decides the version and behaviour for this client. Subsequent calls to XIQueryVersion() will return the same value returned to the first call as long as subsequent values are equal or larger. If smaller, a BadValue must be returned.

So you'd get the following behaviour for a client calling it thrice:
XIQueryVersion(2.1) -> return 2.1
XIQueryVersion(2.2) -> return 2.1
XIQueryVersion(2.0) -> BadValue

This is about the best we can do in the server.
Comment 4 Peter Hutterer 2012-05-01 05:14:24 UTC
X server commit is upstream now: http://cgit.freedesktop.org/xorg/xserver/commit/?id=ea51e9b2877df60135edaf2a8f88d0f2a2b41060

I still think the patch above is the best option for now.
Comment 5 Bastien Nocera 2012-05-17 17:23:10 UTC
Fixed the commit message and removed the SOB.

Pushed to gnome-3-4 and master.