Bug 920595 - Lists of integers instead strings in XklConfigItem when accessed via GObject introspection
Summary: Lists of integers instead strings in XklConfigItem when accessed via GObject ...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gobject-introspection
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Colin Walters
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-12 12:14 UTC by Vratislav Podzimek
Modified: 2015-02-17 14:51 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-02-17 14:51:36 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 950921 1 None None None 2021-01-20 06:05:38 UTC

Internal Links: 950921

Description Vratislav Podzimek 2013-03-12 12:14:02 UTC
Description of problem:
XklConfigItem.name and XklConfigItem.description are suddenly lists of integers instead of strings in the new libxklavier rawhide build. However when built from sources (current master branch) on F17 everything works okay.

Version-Release number of selected component (if applicable):
libxklavier-5.3-2.fc19

How reproducible:
100%

Steps to Reproduce: (on F17, maybe F18 as well)
1. update libxklavier to libxklavier-5.3-2.fc19
2. run test_gi.py in libxklavier's git repository while being in the tests directory (so that the package contents are used)
3. run autogen.sh, configure, make and tests/test_gi.py while being in libxklavier git's toplevel directory (so that the newly built contents are used)
  
Actual results:
Traceback appears when package contents are used while the build contents work as expected.

Expected results:
No difference.

Additional info:
I believe this is a bug caused by a change in a different component, but I can't figure out in which one. However I have identified that the problem lies somewhere in the Xkl-1.0.typelib file because if I replace the one from the package with the one I build myself on my machine (F17), everything works as expected. So the problem probably comes form the tool generating the Xkl-1.0.typelib file.

Comment 1 Fedora End Of Life 2013-04-03 17:30:40 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 2 Vratislav Podzimek 2013-04-19 13:23:32 UTC
(In reply to comment #0)
> Additional info:
> I believe this is a bug caused by a change in a different component, but I
> can't figure out in which one. However I have identified that the problem
> lies somewhere in the Xkl-1.0.typelib file because if I replace the one from
> the package with the one I build myself on my machine (F17), everything
> works as expected. So the problem probably comes form the tool generating
> the Xkl-1.0.typelib file.
From some experiments with builds I found out that the problematic component causing the chnages is gobject-introspection. Reassigning.

Comment 3 Vratislav Podzimek 2013-04-19 13:25:14 UTC
As this prevents multiple language and layout names from being correctly shown in the Anaconda installer, I'm raising the severity of this bug.

Comment 4 Colin Walters 2013-04-19 22:17:10 UTC
Vratislav, one tool you may find useful is "g-ir-generate Xkl.typelib" - it will show you a GIR-like 

Hmm; those are statically-sized arrays of "char".  Fun fact: in C the signedness of "char" is unspecified.

In introspection we default "char *" to mean "NUL-terminated string", but we don't have the same heuristic for arrays.

It's odd to me though; in Fedora 18, Xkl.typelib has these arrays listed as unsigned, but pygobject appears to treat them as strings.  Try this simple script:

#!/usr/bin/env python
from gi.repository import Xkl
item = Xkl.ConfigItem()
print(item)
item.set_name("hello");
print(type(item.name))
print(item.name)

I get "str" and "hello".

Hmm, even more interesting, in Fedora 19, Xkl.typelib has these arrays listed as "gint", but pygobject treats them as integer arrays.  The current gnome-ostree buildmaster has the same behavior as Fedora 19.

Comment 5 Colin Walters 2013-04-19 23:18:33 UTC
Filed with pygobject upstream:

https://bugzilla.gnome.org/show_bug.cgi?id=698416

Comment 6 Vratislav Podzimek 2013-04-22 12:03:59 UTC
I can only confirm what you have found out that the difference between the .typelib with th old behaviour and the new one is in signedness of the arrays.

But I think there are two bugs, that were in past neutralizing each other:
1) how come an array of chars is considered an array of integers?
2) (correct me if I'm wrong) pygobject would consider every array of unsigned integers (if the C code uses such structure) as string

I don't have enough knowledge about the instrospection, but from my point of view arrays of chars should be marked as arrays of chars or strings, not integers. And pygobject shouldn't consider arrays of integers as strings.

So I'm not sure if one upstream bug is enough to resolve this more complex issue. On the other other hand, everything that resolves it for us is greatly welcome, of course.

Thanks for getting things moving so fast!

Comment 7 Colin Walters 2013-04-22 22:14:26 UTC
Vratislav, see updated comments in:
https://bugzilla.gnome.org/show_bug.cgi?id=698416

There's a workaround anaconda can use now.  Once upstream libxklavier accepts my patch, you could also use the get_name() API.

Comment 8 Vratislav Podzimek 2013-04-23 07:51:40 UTC
(In reply to comment #7)
> Vratislav, see updated comments in:
> https://bugzilla.gnome.org/show_bug.cgi?id=698416
> 
> There's a workaround anaconda can use now.  Once upstream libxklavier
> accepts my patch, you could also use the get_name() API.
I've seen the workaround, but I'm affraid we cannot use it. Because we are not comparing the values to something, we are taking them and storing for further use where we need to display them in the UI as strings. So we need to convert them to strings and since it is UTF-8 encoded data, it is quite hard to do that from a list of integers. Look at [1] for what we are using now which is a solution that doesn't work with non-ascii data, because the bytes outside of the 0-255 range are skipped.

[1] https://git.fedorahosted.org/cgit/anaconda.git/tree/pyanaconda/keyboard.py#n296

So I guess I'm gonna hope there is a new libxklavier build soon (both upstream and the package) so that I can change our code. Because from what I've understood from the discussion in the upstream bug, there will be no change in the (py)gobject(-instrospection) that would fix treating a char buffer as an array of integers.

Comment 9 Fedora End Of Life 2015-01-09 17:46:03 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 10 Fedora End Of Life 2015-02-17 14:51:36 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.