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 616647 - gsettings-schema-convert crash
gsettings-schema-convert crash
Status: RESOLVED FIXED
Product: GConf
Classification: Deprecated
Component: gsettings
unspecified
Other Linux
: Normal critical
: ---
Assigned To: GConf Maintainers
GConf Maintainers
: 623408 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-04-23 13:36 UTC by Milan Bouchet-Valat
Modified: 2010-07-02 17:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix call to tostring() (1.04 KB, patch)
2010-05-05 17:38 UTC, Vincent Untz
committed Details | Review

Description Milan Bouchet-Valat 2010-04-23 13:36:30 UTC
I'm getting a "crash" of the script while trying to convert gnome-system-tools's GConf schemas. I've done the conversion manually now, but I guess this bug may hurt other people. Note that it happens on the .schema.in file as well as the .schema file (with translations included).

Maybe I'm doing something wrong, but in this case the error message is really not explicit! ;-)


gnome-system-tools$ /opt/gnome/bin/gsettings-schema-convert --gconf --xml --schema-id "org.gnome.system-tools" --output org.gnome.system-tools.gschema gnome-system-tools.schemas.in
Traceback (most recent call last):
  • File "/opt/gnome/bin/gsettings-schema-convert", line 1073 in <module>
    res = main(sys.argv)
  • File "/opt/gnome/bin/gsettings-schema-convert", line 1047 in main
    output = ET.tostring(tree)
  • File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 1009 in tostring
    ElementTree(element).write(file, encoding)
  • File "/usr/lib/python2.6/xml/etree/ElementTree.py", line 543 in __init__
    assert element is None or iselement(element) AssertionError
The file gnome-system-tools.schemas.in is available at:
http://git.gnome.org/browse/gnome-system-tools/plain/gnome-system-tools.schemas.in?id=75b2947e8fec105704f0bcb3699da0568153c02a

And I'm using glib 2.25.2.
Comment 1 Matthias Clasen 2010-04-23 23:10:01 UTC
Hmm, works ok here.
Comment 2 Milan Bouchet-Valat 2010-05-05 14:24:36 UTC
Actually, it only happens with the --xml option. Else, the file is created fine (but in the other format, of course).

The faulty code is the last line of this block:

        if options.xml:
            node = schema_root.get_xml_node()
            tree = ET.ElementTree(node)
            try:
                output = ET.tostring(tree, pretty_print = True)
            except TypeError:
                # pretty_print only works with lxml
                output = ET.tostring(tree)
Comment 3 Vincent Untz 2010-05-05 17:35:09 UTC
Oh, hrm. Maybe my code when you don't have lxml is wrong. That's some code I was using somewhere else, iirc. Ah, after some investigation, I remember now: I had this issue once before. I think tostring should be called with node instead of tree in this case. I'll attach a patch.
Comment 4 Vincent Untz 2010-05-05 17:38:21 UTC
Created attachment 160363 [details] [review]
Fix call to tostring()
Comment 5 Milan Bouchet-Valat 2010-05-05 17:56:34 UTC
Nice, it mostly works with the patch, except that everything is on a single line, without returns...
Comment 6 Vincent Untz 2010-05-05 17:58:28 UTC
Yes, that's what you get when you don't have lxml. Nothing we can do about it :-) You can use "xmllint --format" to fix that.
Comment 7 Milan Bouchet-Valat 2010-05-05 18:05:45 UTC
OK, one can still add the line breaks manually.

Maybe it would be nice to print a notice, because people may prefer to install lxml support instead.
Comment 8 Vincent Untz 2010-07-02 17:06:38 UTC
*** Bug 623408 has been marked as a duplicate of this bug. ***
Comment 9 Vincent Untz 2010-07-02 17:09:54 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.