Test descriptions with non-ascii characters cause tests to not be run, backend to crash

Bug #833747 reported by Paul Hoell
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
High
Daniel Manrique
checkbox (Ubuntu)
High
Checkbox Developers

Bug Description

I was going through the checkbox tests, when i got a crash-report and checkbox's window became unresponsive.
Due to a non-working firefox which was still picked as browser by apport instead of the selected-as-default chromium, i lost that data package.
I collected this new one on the same instance of the crash with "sudo apport -w".

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: checkbox 0.12.4
ProcVersionSignature: Ubuntu 3.0.0-9.14-generic 3.0.3
Uname: Linux 3.0.0-9-generic x86_64
NonfreeKernelModules: fglrx
Architecture: amd64
Date: Thu Aug 25 14:49:31 2011
ExecutablePath: /usr/share/checkbox/run
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Alpha amd64+mac (20110820)
InterpreterPath: /usr/bin/python2.7
PackageArchitecture: all
ProcEnviron:
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=de_AT.UTF-8
 LANGUAGE=de_AT:de
SourcePackage: checkbox
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Paul Hoell (hoellp) wrote :
Revision history for this message
Paul Hoell (hoellp) wrote :

Sorry for the meta, but i got another automatic crash report to this same crash, is there a way to link the uploaded report to this bugreport?

Revision history for this message
Daniel Manrique (roadmr) wrote :

Hi Paul,

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I think I'm able to replicate this behavior, but I wanted to confirm first whether this file was generated on your system when the crash occurred:

/var/crash/_usr_share_checkbox_backend.0.crash

Or something to that effect indicating that the checkbox backend crashed.

Once you confirm this, which would strongly indicate we're getting the same crash, I'll be able to provide a more detailed analysis on this bug.

Thanks!

Changed in checkbox (Ubuntu):
status: New → Incomplete
Revision history for this message
Paul Hoell (hoellp) wrote :

Of course, thanks for the prompt response...
I attached /var/crash/_usr_share_checkbox_backend.0.crash and cat /var/crash/_usr_share_checkbox_autotest_suite.0.crash from the same crash.

Revision history for this message
Paul Hoell (hoellp) wrote :
Revision history for this message
Daniel Manrique (roadmr) wrote :
Download full text (3.5 KiB)

Paul,

Thanks to you for getting back to me so quickly!

Based on the fact that you also got the backend crash I was expecting, here are steps to reproduce on ubuntu Oneiric (this is mainly for the benefit of developers who are going to work on this bug).

1- install a language that may contain non-ascii characters (so far this has been observed in russian and german):
   sudo apt-get install language-pack-de language-pack-gnome-de
2- Launch checkbox using this installed language:
  LANG=de_AT.UTF-8 LANGUAGE=de_AT:de checkbox-gtk
3- Start a test run with all the tests. It's OK if you skip them, the problem gets triggered either way.

Expected result:
 - All tests run correctly and the run finishes.

Actual result:
- As seen in Paul's checkbox log file, any tests whose description contains non-ascii characters generate an exception (excerpt below).
- As soon as the first job specifying "user" gets dispatched to the backend, the backend crashes with the trace seen in bug 827859. Since it crashed in the middle of executing a job, the frontend doesn't notice this condition and will wait forever. As Paul observed, the window eventually becomes unresponsive.

Here's the description-related trace:

2011-08-25 14:32:53,782 DEBUG Calling checkbox.arguments JobsInfo.replacement({'description': 'Ihr(e) Soundger\xc3\xa4t(e) werden erkan
nt:\n\n$output\n\nIst dies korrekt?', 'plugin': 'manual', 'name': 'audio/list_devices', 'command': 'cat /proc/asound/cards', 'suite': '__audio__', 'requires': "device.c
ategory == 'AUDIO'\npackage.name == 'alsa-base'"}) for report-job with priority -100.
2011-08-25 14:32:53,782 ERROR Error running event handler checkbox.arguments JobsInfo.replacement({'description': 'Ihr(e) Soundger\xc3\xa4t(e) werden erkannt:\n\n$output\n\nIst dies korrekt?', 'plugin': 'manual', 'name': 'audio/list_devices', 'command': 'cat /proc/asound/cards', 'suite': '__audio__', 'requires': "device.category == 'AUDIO'\npackage.name == 'alsa-base'"}) for event type 'report-job'
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/checkbox/reactor.py", line 74, in fire
    results.append(handler(*args, **kwargs))
  File "/usr/lib/python2.7/dist-packages/checkbox/arguments.py", line 90, in replacement
    kwargs)
  File "/usr/lib/python2.7/dist-packages/checkbox/arguments.py", line 66, in replace_arguments
    args[name_index] = self.argument_replacer(name, value)
  File "/usr/lib/python2.7/dist-packages/checkbox/arguments.py", line 83, in replacer
    return schemas[name].coerce(value)
  File "/usr/lib/python2.7/dist-packages/checkbox/properties.py", line 71, in coerce
    return self._variable_class(**self._variable_kwargs).coerce(value)
  File "/usr/lib/python2.7/dist-packages/checkbox/variables.py", line 267, in coerce
    % (attribute, value, e))
ValueError: Value of 'description' key of dict {'description': 'Ihr(e) Soundger\xc3\xa4t(e) werden erkannt:\n\n$output\n\nIst dies korrekt?', 'plugin': 'manual', 'name': 'audio/list_devices', 'command': 'cat /proc/asound/cards', 'suite': '__audio__', 'requires': "device.category == 'AUDIO'\npackage.name == 'alsa-base'"} could not be converted: 'a...

Read more...

Changed in checkbox (Ubuntu):
status: Incomplete → Triaged
importance: Undecided → High
assignee: nobody → Checkbox Developers (checkbox-dev)
Revision history for this message
Daniel Manrique (roadmr) wrote :

Also of note: the first job that runs with user: (and triggers the problem with the backend) is autotest which is NOT included in the default whitelist. Some investigation is needed as to why this job is being run.

Ara Pulido (ara)
Changed in checkbox:
status: New → Triaged
importance: Undecided → High
assignee: nobody → Canonical Hardware Certification (canonical-hw-cert)
milestone: none → 0.12.5
Daniel Manrique (roadmr)
summary: - Checkbox crashes while doing the "delete test-folder test"
+ Test descriptions with non-ascii characters cause tests to not be run,
+ backend to crash
Ara Pulido (ara)
Changed in checkbox:
milestone: 0.12.5 → 0.12.6
Daniel Manrique (roadmr)
Changed in checkbox:
assignee: Canonical Hardware Certification (canonical-hw-cert) → Daniel Manrique (roadmr)
status: Triaged → In Progress
Revision history for this message
Daniel Manrique (roadmr) wrote :

There are two changes to be made here:

- First, checkbox/variable.py, the UnicodeVariable class now uses the 'ascii' encoder by default (decoder in this case I think), so if the string to be converted to unicode contains non-ascii characters, the call to unicode will throw an exception, which was the originally observed problem. Fix is to explicitly specify the encoding to use while reading the string. I used utf-8.

- Second, when loading strings into a GtkTextBuffer, it expects utf8 encoding, otherwise it "eats" characters and the string gets truncated. So we check to see if the passed text is a unicode instance and, if so, it gets explicitly re-encoded as utf8, thus keeping the TextBuffer happy.

I'll link a branch with these fixes in a couple of minutes.

Marc Tardif (cr3)
Changed in checkbox:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package checkbox - 0.12.7

---------------
checkbox (0.12.7) oneiric; urgency=low

  New upstream release (LP: #850395):

  [Brendan Donegan]
  * Redirecting stderr to pipe to fix the gconf_resource script (LP: #832321)
  * Clear jobs directory when user selects No to recover question (LP: #836623)

  [Daniel Manrique]
  * checkbox/job.py: Guard against bogus timeout values (LP: #827859)
  * More explicit handling of string decoding/encoding, avoids problems with
    non-ascii characters (LP: #833747)
  * Changed architecture from all to any for checkbox base, to build
    architecture-specific binaries (LP: #833696)

  [Jeff Lane]
  * Several corrections necessary due to test name changes or typos found in
    job files

  [Marc Tardif]
  * Connecting hyper text widgets only once (LP: #827904)
  * Detecting MMC readers as OTHER instead of DISK (LP: #822948)
  * Validating the hostname in the SSL certificate (LP: #625076)
  * Validating the submission.xml (LP: #838123)
 -- Daniel Manrique <email address hidden> Fri, 14 Sep 2011 17:15:26 -0400

Changed in checkbox (Ubuntu):
status: Triaged → Fix Released
Marc Tardif (cr3)
Changed in checkbox:
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