Bug 36056

Summary: XCB codegen should give a meaningful error message on malformed fieldref
Product: XCB Reporter: Trevour <bio_tube>
Component: UtilsAssignee: xcb mailing list dummy <xcb>
Status: RESOLVED MOVED QA Contact: xcb mailing list dummy <xcb>
Severity: enhancement    
Priority: medium    
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Trevour 2011-04-07 09:38:22 UTC
Take the following example protocol:

<?xml version="1.0" encoding="utf-8"?>

<xcb header="bad" extension-name="bad" extension-xname="BAD">
        <request name="BadRequest" code="0">
                <field type="CARD32" name="sizeField" />
                <list type="CARD8" name="dataVector">
                        <fieldref>vectorSize</fieldref>
                </list>
        </request>
</xcb>

When running it through XCB's codegen, the result is a backtrace and a TypeError that NoneType can't be concatenated with 'str'. As it stands, the error gives no hint that the issue is that vectorSize isn't a previously defined field in the request, which can be easily overlooked(especially if the error is a simple shift failure). Not having any experience in Python, I can't suggest what would be the best fix, but it looks like adding a check in get_type_impl(state.py) for id == NoneType should be sufficient for a simple "Check your fieldrefs" diagnostic.
Comment 1 GitLab Migration User 2019-02-16 19:44:20 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libxcb-cursor/issues/4.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.