~zyga/checkbox/fix-1412660

  • Committer: Zygmunt Krynicki
  • Date: 2015-01-20 13:00:18 UTC
  • Revision ID: zygmunt.krynicki@canonical.com-20150120130018-tbxp307jf5nvvi5g
checkbox-ng:service: fix .via for jobs not in session

This patch fixes a crash when JobDefinitionWrapper.via was being
accessed after resuming a session, when the corresponding job was not
being a part of the session (but is still available on DBus via a
provider).  For example:
 - create a provider with jobs [a, b]
 - create a session with job [a]
 - save the session before a runs
 - resume the session, the session now has [a] but not [b] in it
 - attempt to access b.via

In the current code, this would crash as there was an implicit,
incorrect assumption that each job visible on DBus is also a part of the
current session. The patch corrects that assumption by allowing no
JobState to exist for any JobDefinition.

(A copy of the relevant comment on the bug corresponding report)

1) Job definitions are either generated (and thus bound to a session) or
   not (and thus bound to a provider)
2) The .via property was previously a mutable state on a job. Now it is
   something one can access from session-bound JobState.
   2a) this means that .via cannot be accessed before a session exists
   2b) this means that .via cannot be accessed if a session doesn't
       contain a given job (despite that job existing).

In the past, via was always accessible, perhaps holding nothing or
perhaps holding stale data (from previous session run).  Currently when
2b happens, we crash.

The fix is to simply return "" when there is no session or there
is no corresponding JobState in the session.

Fixes: https://bugs.launchpad.net/checkbox-ng/+bug/1412660
Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Filename Latest Rev Last Changed Committer Comment Size
..
cep 3513.2.1 9 years ago Zygmunt Krynicki cep: merge CEPs in to trunk This patch merges CEP Diff
checkbox-gui 2549.2.3 10 years ago Brendan Donegan Rename plainbox-gui and canonical-driver-test-suit Diff
checkbox-ng 2128.1.1 11 years ago Zygmunt Krynicki checkbox-ng: add CheckBoxNG sub-project CheckBoxN Diff
checkbox-support 2585.1.2 10 years ago Sylvain Pineau checkbox-support: Copy required modules from check Diff
checkbox-touch 3178.1.1 9 years ago Zygmunt Krynicki checkbox-touch: generate simple checkbox-touch app Diff
plainbox 0.1.26 11 years ago Zygmunt Krynicki Rename new-root to plainbox Diff
plainbox-client 2418.2.1 10 years ago Zygmunt Krynicki plainbox-client: add the new plainbox client packa Diff
providers 2716.1.1 10 years ago Zygmunt Krynicki providers: add the meta-test provider PlainBox ca Diff
support 2145.1.8 11 years ago Zygmunt Krynicki support: add dependency support module This patch Diff
.bzrignore 2810.1.1 10 years ago Zygmunt Krynicki .{git,bzr}ignore: ignore checkbox-gui build stuff 1.1 KB Diff Download File
.coveragerc 2708.1.9 10 years ago Zygmunt Krynicki .coveragerc: sort entries 545 bytes Diff Download File
.gitignore 3211.1.3 9 years ago Zygmunt Krynicki .gitignore: ignore lxc-logs/ Signed-off-by: Zygmu 1.3 KB Diff Download File
.travis.yml 3391 9 years ago Daniel Manrique "Release_2014_Week45 [r=sylvain-pineau][bug=133130 3.2 KB Diff Download File
Symlink mk-venv 2145.1.8 11 years ago Zygmunt Krynicki support: add dependency support module This patch .
README.md 3516.1.1 9 years ago Zygmunt Krynicki cep: add README files This patch adds a new READM 2.4 KB Diff Download File
File setup.py 2808.1.14 10 years ago Zygmunt Krynicki support: don't multiplex to checkbox-old 1.5 KB Diff Download File
File tarmac-verify 3026.1.1 10 years ago Daniel Manrique tarmac-verify: fix setting of KEEP_DATA environmen 1 KB Diff Download File
File test-in-lxc.sh 3072.1.1 10 years ago Daniel Manrique test-in-lxc: fix recommended sudo configuration fo 10 KB Diff Download File
File test-in-vagrant.sh 2973.1.2 10 years ago Daniel Manrique test-in-vagrant: Use per-component mini-scripts fo 5.1 KB Diff Download File
Symlink test-with-coverage 2708.1.8 10 years ago Zygmunt Krynicki support: beef up test-with-coverage This patch ma .
Vagrantfile 2974.1.1 10 years ago Daniel Manrique provision-vagrant: A few changes to support other 2.4 KB Diff Download File