~apparmor-dev/apparmor/2.10

Viewing all changes in revision 3405.

  • Committer: Steve Beattie
  • Date: 2017-10-19 00:09:42 UTC
  • Revision ID: sbeattie@ubuntu.com-20171019000942-ug7qgbchoat3qq4i
libapparmor: fix swig test_apparmor.py for zero length ptrace records
Merge from trunk revision 3715

The added testcase for a ptrace target with an empty string
(ptrace_garbage_lp1689667_1.in) was causing the swig python test script
to fail. The generated python swig record for libapparmor ends up
setting a number of fields to None or other values that indicate the
value is unset, and the test script was checking if the value in the
field didn't evaluate to False in a python 'if' test.

Unfortunately, python evaluates the empty string '' as False in 'if'
tests, resulting in the specific field that contained the empty string
to be dropped from the returned record. This commit fixes that by
special case checking for the empty string.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: John Johansen <john.johansen@canonical.com>

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: