internet_test crashed with TypeError in ping(): 'NoneType' object is not subscriptable

Bug #1232774 reported by Jonathan Brier
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
Undecided
Unassigned
checkbox (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

running system testing and crash appeared upon landing on the optical/read_sr0 test after performing the previous tests

ProblemType: Crash
DistroRelease: Ubuntu 13.10
Package: checkbox 0.16.6
ProcVersionSignature: Ubuntu 3.11.0-9.16-generic 3.11.2
Uname: Linux 3.11.0-9-generic x86_64
ApportVersion: 2.12.5-0ubuntu1
Architecture: amd64
Date: Sun Sep 29 10:52:59 2013
EcryptfsInUse: Yes
ExecutablePath: /usr/lib/checkbox/bin/internet_test
InstallationDate: Installed on 2012-11-29 (303 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release amd64 (20121017.5)
InterpreterPath: /usr/bin/python3.3
MarkForUpload: True
ProcCmdline: /usr/bin/python3 /usr/share/checkbox/scripts/internet_test
PythonArgs: ['/usr/share/checkbox/scripts/internet_test']
SourcePackage: checkbox
Title: internet_test crashed with TypeError in ping(): 'NoneType' object is not subscriptable
UpgradeStatus: Upgraded to saucy on 2013-09-28 (0 days ago)
UserGroups: adm cdrom dip lpadmin plex plugdev sambashare sudo vboxusers

Related branches

Revision history for this message
Jonathan Brier (brierjon) wrote :
tags: removed: need-duplicate-check
Changed in checkbox (Ubuntu):
importance: Undecided → Medium
Daniel Manrique (roadmr)
information type: Private → Public
tags: added: scripts
Revision history for this message
Daniel Manrique (roadmr) wrote :

First, the script was renamed to gateway_ping_test because internet_test was misleading. However, the potentially offending code is still there.

The ping() method parses ping's output according to a regex, and then refers to the regex's matches. If ping output didn't match the regex, the match list will be empty, prompting this error.

From my analysis this could happen only two ways:
1- Ping is run with a different locale, causing the summary line to be in a different language and matching to fail.
2- Ping is simply not present. Unlike the newer subprocess.check_* functions, the popen mechanism the script uses will not throw an exception if the command fails to run; it will just return an empty list.

A possible failure scenario is if the ping target is not resolvable, but in this case the test handles it correctly.

Work to do:
Refactor the ping() method so that:
1- Runs ping in an unlocalized environment (LANG=en_US.UTF-8 and LANGUAGE=en, or maybe C or POSIX).
2- Preferrably, it uses subprocess.check_output to run ping, and properly handles the exception with a fatal error due to absence of ping. "Properly handles" may involve actually ignoring the exception to let the invoking code decide what to do.
3- If the regex doesn't match ping output at all, assume the internet connection is down. This can be done by just returning None if it didn't match, the rest of the code will interpret that as "no connection".
4- The code invoking ping() could handle the CalledProcessError when ping is absent to print a relevant error message.

Changed in checkbox:
importance: Undecided → Medium
status: New → Triaged
Changed in checkbox (Ubuntu):
status: New → Triaged
Changed in checkbox:
milestone: none → 2014-jan-31
Changed in checkbox (Ubuntu):
milestone: none → ubuntu-14.04-feature-freeze
Changed in checkbox:
milestone: 2014-jan-31 → 2014-feb-14
Zygmunt Krynicki (zyga)
Changed in checkbox:
milestone: 2014-feb-14 → 2013-feb-28
Changed in checkbox:
milestone: 2013-feb-28 → 2014-mar-14
Daniel Manrique (roadmr)
Changed in checkbox:
milestone: 2014-mar-14 → 2014-apr-11
Zygmunt Krynicki (zyga)
no longer affects: checkbox
Changed in plainbox-provider-checkbox:
status: New → Confirmed
Changed in checkbox (Ubuntu):
milestone: ubuntu-14.04-feature-freeze → ubuntu-16.04
status: Triaged → Fix Released
Changed in plainbox-provider-checkbox:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.