onboard keyboard crashes when started in node.js running custom layout

Bug #1249493 reported by Brian Newberry on 2013-11-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Onboard
Low
Unassigned
onboard (Ubuntu)
Undecided
Unassigned

Bug Description

lsb_release -rd:
Description: Ubuntu 12.04.1 LTS
Release: 12.04

apt-cache policy onboard:
onboard:
  Installed: 0.99.0-0ppa~precise1
  Candidate: 0.99.0-0ppa~precise1
  Version table:
 *** 0.99.0-0ppa~precise1 0
        500 http://ppa.launchpad.net/onboard/stable/ubuntu/ precise/main amd64 Packages
        100 /var/lib/dpkg/status
     0.97.0-0ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
     0.97.0-0ubuntu3 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

apt-cache policy python:
python:
  Installed: 2.7.3-0ubuntu2.2
  Candidate: 2.7.3-0ubuntu2.2
  Version table:
 *** 2.7.3-0ubuntu2.2 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     2.7.3-0ubuntu2 0
        500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages

I thought I had everything setup just the way I wanted it, but all the sudden, it started having problems on one of my three deployments. Don't really know what happened as everyone swears they didn't do anything. I have installed onboard 0.99 from the stable ppa onto Ubuntu 12.04. I have python 2.7.3.

Here is my situation:
1) When I try to open onboard with a custom layout from the console, it works fine
2) When I try to open onboard with a non-custom layout (like Compact specifically is what I tested) programmatically from within a node.js program it works fine
3) When I try to open onboard with a custom layout (made from Compact, not even modified yet) programmatically from within a node.js program, it crashes with the following error messages put out to stderr:

 Traceback (most recent call last):
  File "/usr/bin/onboard", line 16, in <module>
    ob = Onboard()
  File "/usr/lib/python3/dist-packages/Onboard/OnboardGtk.py", line 111, in __init__
    self.init()
  File "/usr/lib/python3/dist-packages/Onboard/OnboardGtk.py", line 180, in init
    self.reload_layout()
  File "/usr/lib/python3/dist-packages/Onboard/OnboardGtk.py", line 560, in reload_layout
    self.load_layout(layout_filename, color_scheme_filename)
  File "/usr/lib/python3/dist-packages/Onboard/OnboardGtk.py", line 581, in load_layout
    layout = LayoutLoaderSVG().load(vk, layout_filename, color_scheme)
  File "/usr/lib/python3/dist-packages/Onboard/LayoutLoaderSVG.py", line 84, in load
    os.path.dirname(layout_filename))
  File "/usr/lib/python3/dist-packages/Onboard/LayoutLoaderSVG.py", line 103, in _load
    return self._load_layout(layout_filename, parent_item)
  File "/usr/lib/python3/dist-packages/Onboard/LayoutLoaderSVG.py", line 111, in _load_layout
    dom = minidom.parse(f).documentElement
  File "/usr/lib/python3.2/xml/dom/minidom.py", line 1945, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python3.2/xml/dom/expatbuilder.py", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: syntax error: line 2, column 0

Here is the xml file named NextGen.onboard that it's crashing from:
<?xml version="1.0" ?>
<keyboard id="Compact" format="3.1">

    <include file='key_defs.xml'/>

    <box border="1" spacing="1.5" orientation="vertical">

        <!--- word suggestions -->
        <panel filename='Compact-Alpha.svg' scan_priority='1'>
            <include file='word_suggestions.xml'/>
        </panel>

        <box spacing='1.5'>
            <box spacing='2'>
                <!--- keyboard, multiple layers -->
                <panel>
                    <panel layer="alpha" filename="Compact-Alpha.svg">
                        <key group="alphanumeric" id="AB01"/>
                        <key group="alphanumeric" id="AE02"/>
                        <key group="alphanumeric" id="AE03"/>
                        <key group="alphanumeric" id="AD09"/>
                        <key group="alphanumeric" id="AE01"/>
                        <key group="alphanumeric" id="AE06"/>
                        <key group="alphanumeric" id="AE07"/>
                        <key group="alphanumeric" id="AE04"/>
                        <key group="alphanumeric" id="AE05"/>
                        <key group="alphanumeric" id="AD03"/>
                        <key group="alphanumeric" id="AD02"/>
                        <key group="alphanumeric" id="AD01"/>
                        <key group="alphanumeric" id="AE09"/>
                        <key group="alphanumeric" id="AD07"/>
                        <key group="alphanumeric" id="AD06"/>
                        <key group="alphanumeric" id="AD05"/>
                        <key group="alphanumeric" id="AD04"/>
                        <key group="alphanumeric" id="AB10"/>
                        <key group="alphanumeric" id="AC11"/>
                        <key group="alphanumeric" id="AC10"/>
                        <key group="alphanumeric" id="TLDE"/>
                        <key group="alphanumeric" id="LSGT"/>
                        <key group="alphanumeric" id="BKSL"/>
                        <key group="alphanumeric" id="AD10"/>
                        <key group="alphanumeric" id="AD11"/>
                        <key group="alphanumeric" id="AD12"/>
                        <key group="alphanumeric" id="AB08"/>
                        <key group="alphanumeric" id="AE11"/>
                        <key group="alphanumeric" id="AE10"/>
                        <key group="alphanumeric" id="AE12"/>
                        <key group="alphanumeric" id="AC04"/>
                        <key group="alphanumeric" id="AC05"/>
                        <key group="alphanumeric" id="AC06"/>
                        <key group="alphanumeric" id="AC07"/>
                        <key group="alphanumeric" id="AB09"/>
                        <key group="alphanumeric" id="AC01"/>
                        <key group="alphanumeric" id="AC02"/>
                        <key group="alphanumeric" id="AC03"/>
                        <key group="alphanumeric" id="AB05"/>
                        <key group="alphanumeric" id="AB04"/>
                        <key group="alphanumeric" id="AE08"/>
                        <key group="alphanumeric" id="AB06"/>
                        <key group="alphanumeric" id="AC08"/>
                        <key group="alphanumeric" id="AC09"/>
                        <key group="alphanumeric" id="AB03"/>
                        <key group="alphanumeric" id="AB02"/>
                        <key group="alphanumeric" id="AD08"/>
                        <key group="alphanumeric" id="AB07"/>

                        <key group='misc' id='CAPS'/>
                        <key group='shifts' id='LFSH'/>
                        <key group='shifts' id='RTSH'/>
                        <key group='bottomrow' id='LCTL'/>
                        <key group='bottomrow' id='LALT'/>
                        <key group='bottomrow' id='RALT'/>
                        <key group="bottomrow" id="LWIN"/>

                        <key group="bottomrow" id="SPCE"/>
                        <key group="bottomrow" id="DELE.next-to-backspace"/>
                        <key group="bottomrow" id="BKSP"/>
                        <key group="misc" id="TAB"/>
                        <key group="misc" id="RTRN"/>
                        <key group="directions_alpha" id="LEFT"/>
                        <key group="directions_alpha" id="RGHT"/>
                        <key group="directions_alpha" id="UP"/>
                        <key group="directions_alpha" id="DOWN"/>
                    </panel>
                    <panel layer="numbers" filename="Compact-Numbers.svg" border="2">
                        <key group='keypadmisc' id='NMLK' scan_priority='2'/>
                        <key group="keypadmisc" id="KPDL" scan_priority="2"/>
                        <key group="keypadmisc" id="KPEN" scan_priority="2"/>
                        <key group="keypadnumber" id="KP0" scan_priority="2"/>
                        <key group="keypadnumber" id="KP1" scan_priority="2"/>
                        <key group="keypadnumber" id="KP2" scan_priority="2"/>
                        <key group="keypadnumber" id="KP3" scan_priority="2"/>
                        <key group="keypadnumber" id="KP4" scan_priority="2"/>
                        <key group="keypadnumber" id="KP5" scan_priority="2"/>
                        <key group="keypadnumber" id="KP6" scan_priority="2"/>
                        <key group="keypadnumber" id="KP7" scan_priority="2"/>
                        <key group="keypadnumber" id="KP8" scan_priority="2"/>
                        <key group="keypadnumber" id="KP9" scan_priority="2"/>
                        <key group="keypadoperators" id="KPSU" scan_priority="2"/>
                        <key group="keypadoperators" id="KPDV" scan_priority="2"/>
                        <key group="keypadoperators" id="KPAD" scan_priority="2"/>
                        <key group="keypadoperators" id="KPMU" scan_priority="2"/>
                        <key group="directions" id="LEFT" scan_priority="1"/>
                        <key group="directions" id="RGHT" scan_priority="1"/>
                        <key group="directions" id="UP" scan_priority="1"/>
                        <key group="directions" id="DOWN" scan_priority="1"/>
                        <key group="editing" id="INS"/>
                        <key group="editing" id="DELE" label='Del' image=''/>
                        <key group="editing" id="HOME"/>
                        <key group="editing" id="END"/>
                        <key group="editing" id="PGUP"/>
                        <key group="editing" id="PGDN"/>

                        <key group="bottomrow" id="ESC"/>
                        <key group="fkeys" id="F1.rows_of_six"/>
                        <key group="fkeys" id="F2.rows_of_six"/>
                        <key group="fkeys" id="F3.rows_of_six"/>
                        <key group="fkeys" id="F4.rows_of_six"/>
                        <key group="fkeys" id="F5.rows_of_six"/>
                        <key group="fkeys" id="F6.rows_of_six"/>
                        <key group="fkeys" id="F7.rows_of_six"/>
                        <key group="fkeys" id="F8.rows_of_six"/>
                        <key group="fkeys" id="F9.rows_of_six"/>
                        <key group="fkeys" id="F12.rows_of_six"/>
                        <key group="fkeys" id="F10.rows_of_six"/>
                        <key group="fkeys" id="F11.rows_of_six"/>
                        <key group="editing" id="Prnt" scan_priority="1"/>
                        <key group="editing" id="Pause" scan_priority="1"/>
                        <key group="editing" id="Scroll" scan_priority="1"/>
                    </panel>
                    <panel layer="utils" filename="Compact-Utils.svg" border="2">
                        <key group='snippets' id='m0'/>
                        <key group='snippets' id='m1'/>
                        <key group='snippets' id='m2'/>
                        <key group='snippets' id='m3'/>
                        <key group='snippets' id='m4'/>
                        <key group='snippets' id='m5'/>
                        <key group='snippets' id='m6'/>
                        <key group='snippets' id='m7'/>
                        <key group='snippets' id='m8'/>
                        <key group='snippets' id='m9'/>
                        <key group='snippets' id='m10'/>
                        <key group='snippets' id='m11'/>
                        <key group='snippets' id='m12'/>
                        <key group='snippets' id='m13'/>
                        <key group='snippets' id='m14'/>
                        <key group='snippets' id='m15'/>
                        <key group='bottomrow' id='quit' scan_priority="1"/>
                        <key group='bottomrow' id='settings' scan_priority="1"/>
                    </panel>
                </panel>

            </box>

            <!--- click helpers -->
            <panel id="click" filename="Compact-Alpha.svg" >
                <key group='click' id='middleclick'/>
                <key group='click' id='secondaryclick'/>
                <key group='click' id='doubleclick'/>
                <key group='click' id='dragclick'/>
                <key group='click' id='hoverclick.bottom-row' unlatch_layer="false"/>
            </panel>

            <!--- side bar -->
            <panel id="paneswitch" filename="Compact-Alpha.svg">
                <box compact="true" orientation='vertical'>
                    <panel group='nowordlist'>
                        <key group='bottomrow' id='hide'/>
                        <box orientation='vertical'>
                            <box orientation="horizontal" expand="false">
                                <key group="bottomrow" id="showclick"/>
                                <key group="bottomrow" id="move"/>
                            </box>
                            <key group="bottomrow" id="layer0" scan_priority="3"/>
                            <key group="bottomrow" id="layer1" scan_priority="3"/>
                            <key group="bottomrow" id="layer2" scan_priority="3"/>
                        </box>
                    </panel>
                    <panel group='wordlist'>
                        <box orientation='vertical'>
                            <key group='sidebar' id='move' svg_id='move.wordlist' expand='false' label_margin='2.5'/>
                            <key group='sidebar' id='showclick' svg_id='showclick.wordlist' label_margin='2' expand='false'/>
                            <key group='bottomrow' id='layer0' svg_id='layer0.wordlist' scan_priority='3'/>
                            <key group='bottomrow' id='layer1' svg_id='layer1.wordlist' scan_priority='3'/>
                            <key group="bottomrow" id="layer2" svg_id='layer2.wordlist' scan_priority="3"/>
                        </box>
                    </panel>
                </box>
            </panel>

        </box>
    </box>
</keyboard>

I have put this file through xml validators and it comes up clean.

I googled the first error about OnboardGtk.py line 111 and found that others fixed their problems by making sure they had librsvg2-common installled, but I already had that installed. Tried to install anyway just to make sure there wasn't an upgrade problem, but it said I was on the latest version.

This one has really got me stumped and I wonder if it's not some sort of problem with onboard hence why I'm posting what I think is a bug.

marmuta (marmuta) wrote :

Implanted into a new layout, the part you posted loads without the error here. There might be something with the file, perhaps the encoding, but it's hard to tell from pasted text. Could you attach an archive of the whole layout?
$ tar -cvzf NextGen.tar.gz ~/.local/share/onboard/layouts/NextGen*

Also, check if that is the file that is actually loaded. The path can be found in Onboard's debug output. Look for the "Loading keyboard layout from" line.
$ onboard -ddebug

A missing librsvg2-common would cause a different error, a little later when images are loaded. 0.99.1 will fix this.

So, I figured out what it was. . . the file was fine and onboard is working fine, but with some unexpected and desired results. I had created a ubuntu shortcut file named NextGen in the same directory from which I was running my program. This seemed to cause onboard to use that file instead of the keyboard layouts in ~/.local/share/onboard/layouts.

It seems that onboard has a three stage lookup process for where to find the layout file it is being asked to load: 1) local directory, 2) users custom layouts, or 3) global layouts location. The problem it seems I uncovered is that when you have another file with the same name as a custom layout name in your local directory, it tries to load from the local directory even if the other files aren't there (no svg files). Also, my local file had no .onboard suffix and onboard still tried to load it.

This should probably be a pretty low priority, but I would recommend you move to a stricter name comparison and look for the .onboard suffix to make sure that the local file really is an onboard configuration file and not just an unfortunately named file.

I will remember to look at onboard -ddebug next time I have a problem as well as this again would have solved my problem much quicker by telling me which file it was loading. Thanks for the tip!

For now, I am going to just rename the custom layout name to something much more specific like NextGenKeyboardLayout that will never be duplicated and go on my way.

Thanks so much for the response, other than this problem I have been very satisfied with onboard, especially after updating from 0.97 to 0.99.

marmuta (marmuta) wrote :

Thanks for the investigation, and yes, this three stage lookup exists for most of Onboard's files. The problem seems to be that stage 1) is meant for absolute paths, rather than local directories, but this isn't enforced. As you discovered, having a file in the current directory with the same name as the layout to be loaded triggers this bug.
I think, instead of looking at the various extensions, we can simply check for an absolute path. I'll look into that.

Good to hear you're happy with 0.99. I appreciate the feedback, we don't get that much for Precise.

One more suggestion: you can of course copy layouts by hand, but the easiest way to start a new layout is by pressing the "Personalize" button in Preferences->Layouts. This way you get copies of all the necessary files, and the filename references in the *.onboard file are adjusted too.

Changed in onboard (Ubuntu):
status: New → Confirmed
Changed in onboard:
status: New → Confirmed
importance: Undecided → Low
marmuta (marmuta) wrote :

Should be fixed in trunk now. I've added a check for absolute paths when locating layouts, themes, etc..

Changed in onboard:
status: Confirmed → Fix Committed
Launchpad Janitor (janitor) wrote :
Download full text (4.2 KiB)

This bug was fixed in the package onboard - 1.0.0-0ubuntu1

---------------
onboard (1.0.0-0ubuntu1) trusty; urgency=low

  * Request for sponsorship for new upstream release (LP: #1282231)
  * debian/control:
    - Raise Standards-Version to 3.9.5
    - Add librsvg2-common to Depends for Kubuntu (LP: #1204896)
  * debian/onboard.install:
    - Use usr/share/onboard/onboard-defaults.conf* instead of single entries
    - Add the usr/share/onboard/tools/checkmodels file
  * debian/patches/add_defaults_for_ubuntu.patch:
    - Update add_defaults_for_ubuntu.patch with values for this release
  * Word suggestions enhancements:
    - Every language id now has its own user language model
    - Add a checkbox to the Preferences to show the language switch on layouts
    - Add a checkbox to the Preferences to show the pause learning button
    - Add Canadian English system language model
    - Add Danish system language model
    - Add various flavors of the Dutch system language model
    - Add Gaelic system language model
    - Add Greek system language model
    - Add Irish system language model
    - Add Luxembourgian system language model.
    - Add Polish system language model
    - Add Romanian system language model
    - Add Swedish system language model
    - Add Turkish system language model
    - Update Brazilian system language model
    - Improve makemodels script
    - Add model_info tool
    - Add checkmodels tool to diagnose language model loading errors
    - Add tool to randomize sentences in corpora
    - Add copy function to allow transfer between language models
    - Add smart support for camel-case words (Thanks Michael Bauer)
    - Make language switcher more user-friendly (Thanks Michael Bauer)
    - Stop word correction when spell checker dictionary is not present
    - Fix learning of text spans larger than 100 characters
    - Fix word suggestions sometimes being unaware of modifier presses
    - Fix all upper-case words not being suggested at sentence begin
    - Fix wrong caret position in rename function of Nautilus
    - Fix some character deletion on focus change after a word completion
    - Fix bit rot in split_corpus tool
    - Improve handling of the / and other non-word tokens
    - Improve support for URLs and directories
    - Don't learn passwords from URLs
    - Show dialog on language model loading error (LP: #1278599)
  * Layouts:
    - Add support for polygonal keys instead of only rectangles (LP: #1259371)
    - Make the Return key of the Compact and Full Keyboard layouts a polygon
    - Don't write suggestions outside prediction area in Onboard
    - Grid layout: add settings,move,hide,quit and click buttons (LP: #754391)
    - Add Whiteboard and Whiteboard wide layouts (contributed by Johannes Almer)
    - Add short and long description to the layouts
    - Perform small visual improvements
  * Change the design of the layout section in the Preferences
  * Tweak themes lightly
  * Click buttons:
    - Add support for new mousetweaks branch (version >= 3.9)
    - Fix CSClickMapper sometimes erroneously claiming to be active
  * Add dependencies check to setup.py
  * Add gsettings key to choose between App...

Read more...

Changed in onboard (Ubuntu):
status: Confirmed → Fix Released
Francesco Fumanti (frafu) wrote :

This bug should be fixed with the 1.0.0 release. If you still encounter problems, please feel free to reopen this bug or file a new one.

Changed in onboard:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers