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 354515 - dogtail crashes with a UnicodeDecodeError: "'utf8' codec can't decode byte ..." error when running example
dogtail crashes with a UnicodeDecodeError: "'utf8' codec can't decode byte .....
Status: RESOLVED FIXED
Product: dogtail
Classification: Deprecated
Component: Framework
0.6.0
Other All
: Normal critical
: ---
Assigned To: Dogtail Maintainers
Dogtail Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-09-05 20:53 UTC by Phil Muldoon
Modified: 2006-09-18 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot of AT-SPI sniff (22.03 KB, image/png)
2006-09-05 20:58 UTC, Phil Muldoon
Details

Description Phil Muldoon 2006-09-05 20:53:39 UTC
Steps to reproduce:
1. Fedora Rawhide
2. python gedit-test-utf8-procedural-api.py
3. 


Stack trace:
[pmuldoon@dhcp-199 examples]$ python gedit-test-utf8-procedural-api.py 
Creating logfile at /tmp/dogtail/logs/gedit-test-utf8-procedural-api_20060905-155027 ...
Detecting distribution: Red Hat/Fedora/derived distribution
GTK Accessibility Module initialized
Bonobo accessibility support initialized
Traceback (most recent call last):
  • File "gedit-test-utf8-procedural-api.py", line 30 in ?
    run('gedit')
  • File "/usr/lib/python2.4/site-packages/dogtail/procedural.py", line 310 in run
    focus.application(application)
  • File "/usr/lib/python2.4/site-packages/dogtail/procedural.py", line 57 in __call__
    app = self.desktop.findChild(predicate, recursive = False, retry = False)
  • File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 845 in findChild
    result = findFirstChildSatisfying(self, pred, recursive)
  • File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 817 in findFirstChildSatisfying
    if child.satisfies(pred):
  • File "/usr/lib/python2.4/site-packages/dogtail/tree.py", line 685 in satisfies
    return pred.satisfiedByNode(self)
  • File "/usr/lib/python2.4/site-packages/dogtail/predicate.py", line 95 in satisfiedByNode
    return node.roleName=='application' and stringMatches(self.appName, node.name)
  • File "/usr/lib/python2.4/site-packages/dogtail/predicate.py", line 13 in stringMatches
    return scriptName.matchedBy(reportedName)
  • File "/usr/lib/python2.4/site-packages/dogtail/i18n.py", line 160 in matchedBy
    return stringsMatch(self.untranslatedString, string)
  • File "/usr/lib/python2.4/site-packages/dogtail/i18n.py", line 140 in stringsMatch
    outString = outString.decode('utf-8')
  • File "/usr/lib/python2.4/encodings/utf_8.py", line 16 in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa8 in position 0: unexpected code byte


Other information:
We first noticed this when the frysk dogtail test suite crashed on rawhide:

The offending code (tree.root.application ....)

   # Start up Frysk 
    run ( FryskBinary, appName=FRYSK_APP_NAME )
    fryskObject = tree.root.application ( FRYSK_APP_NAME )

Crashed at that point. Checked sanity of FRYSK_APP_NAME turns out fine. However using the AT-SPI sniff tool in the Programming -> AT_SPI Browser menu reveals some applications with some odd names. One was named ?#? and others. I can affix a screenshot if you need it. Sanity checked with the examples. It seems when dogtail walks the tree, badly encoded strings cause it to crash.
Comment 1 Phil Muldoon 2006-09-05 20:58:38 UTC
Created attachment 72277 [details]
Screenshot of AT-SPI sniff

Added screenshot of AT_SPI sniff observing strange application names
Comment 2 Zack Cerza 2006-09-05 21:06:02 UTC
Sigh. I guess dogtail needs yet another workaround to avoid broken apps. I encourage you to try and figure out which apps are broken, and to either let me know or file bugs on them yourself.
Comment 3 Phil Muldoon 2006-09-06 15:14:33 UTC
Agreed that the bad apps cause havoc. A two point approach. I'll try and identify the broken apps and report them.

However, AT-SPI sniff deals with the busted names, can we make dogtail as robust as AT-SPI, or more robust?

BTW Frysk is reported as Frysk, so it's not Frysk that is busted. It seems the tree walkers hits the weird names first, then dies.
Comment 4 Zack Cerza 2006-09-06 15:28:28 UTC
My plan was to get this workaround written first thing today, but several other issues seem to have popped up in the meantime. It is a high priority, though.
Comment 5 Zack Cerza 2006-09-07 21:38:55 UTC
I just committed a fix to this bug. Dogtail should never crash because of an invalid Unicode string again. If it does, please reopen this bug.
Comment 6 Zack Cerza 2006-09-18 21:07:21 UTC
The bug was fixed in 0.6.0.