Merge ~arighi/qa-regression-testing:support-python2-and-python3 into qa-regression-testing:master

Proposed by Andrea Righi
Status: Rejected
Rejected by: Steve Beattie
Proposed branch: ~arighi/qa-regression-testing:support-python2-and-python3
Merge into: qa-regression-testing:master
Diff against target: 52 lines (+16/-4)
4 files modified
scripts/kernel-security/errno-read.py (+4/-1)
scripts/kernel-security/proc-leaks/dac-bypass.py (+4/-1)
scripts/kernel-security/proc-maps/maps-protection.py (+4/-1)
scripts/test-kernel-security.py (+4/-1)
Reviewer Review Type Date Requested Status
Ubuntu Security Team Pending
Review via email: mp+440700@code.launchpad.net

Description of the change

In lunar we are getting some test failures reporting the error:

 /usr/bin/env: ‘python2’: No such file or directory

Fix by changing the shebang of the scripts in kernel-security to dynamically detect the availability of python2 or python3.

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

This overlaps https://code.launchpad.net/~fginther/qa-regression-testing/+git/qa-regression-testing/+merge/440503.

I'd prefer to just convert all of these to python3 as we really have no reason to keep running these with python2 (we have python 3.4 in trusty which is as far back as we would need to run any kernel testing).

I'll propose another MP to address dac-bypass.py and test-kernel-security.py.

Revision history for this message
Francis Ginther (fginther) wrote :

I recommend replacing this MP with https://code.launchpad.net/~fginther/qa-regression-testing/+git/qa-regression-testing/+merge/440800 which applies additional 2to3 updates.

Revision history for this message
Steve Beattie (sbeattie) wrote :

My apologies for not getting to this earlier, other commits have landed that address the same issues.

Unmerged commits

1c71217... by Andrea Righi

kernel-security: support both python2 and python3

python2 has been removed in Lunar. Change the shebang of the python
scripts to select either python2 or python3 at runtime, depending on
which one is available in the system.

Signed-off-by: Andrea Righi <email address hidden>

Succeeded
[SUCCEEDED] imagemagick:0 (build)
[SUCCEEDED] imagemagick:1 (build)
[SUCCEEDED] imagemagick:2 (build)
[SUCCEEDED] gcc-security:0 (build)
[SUCCEEDED] gcc-security:1 (build)
[SUCCEEDED] gcc-security:2 (build)
[SUCCEEDED] gnupg:0 (build)
[SUCCEEDED] gnupg:1 (build)
[SUCCEEDED] gnupg:2 (build)
[SUCCEEDED] sudo:0 (build)
[SUCCEEDED] sudo:1 (build)
[SUCCEEDED] sudo:2 (build)
[SUCCEEDED] imagemagick:0 (build)
[SUCCEEDED] imagemagick:1 (build)
[SUCCEEDED] imagemagick:2 (build)
[SUCCEEDED] gcc-security:0 (build)
[SUCCEEDED] gcc-security:1 (build)
[SUCCEEDED] gcc-security:2 (build)
[SUCCEEDED] gnupg:0 (build)
[SUCCEEDED] gnupg:1 (build)
[SUCCEEDED] gnupg:2 (build)
[SUCCEEDED] sudo:0 (build)
[SUCCEEDED] sudo:1 (build)
[SUCCEEDED] sudo:2 (build)
[SUCCEEDED] imagemagick:0 (build)
[SUCCEEDED] imagemagick:1 (build)
[SUCCEEDED] imagemagick:2 (build)
[SUCCEEDED] gcc-security:0 (build)
[SUCCEEDED] gcc-security:1 (build)
[SUCCEEDED] gcc-security:2 (build)
[SUCCEEDED] gnupg:0 (build)
[SUCCEEDED] gnupg:1 (build)
[SUCCEEDED] gnupg:2 (build)
[SUCCEEDED] sudo:0 (build)
[SUCCEEDED] sudo:1 (build)
[SUCCEEDED] sudo:2 (build)
136 of 36 results

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/scripts/kernel-security/errno-read.py b/scripts/kernel-security/errno-read.py
2index 8e31c38..27605da 100755
3--- a/scripts/kernel-security/errno-read.py
4+++ b/scripts/kernel-security/errno-read.py
5@@ -1,4 +1,7 @@
6-#!/usr/bin/env python2
7+#!/bin/sh
8+''':'
9+if which python3 > /dev/null 2>&1; then exec python3 "$0" "$@"; else exec python2 "$0" "$@"; fi
10+'''
11 from __future__ import print_function
12 import sys
13 try:
14diff --git a/scripts/kernel-security/proc-leaks/dac-bypass.py b/scripts/kernel-security/proc-leaks/dac-bypass.py
15index 740bacb..9148b8b 100755
16--- a/scripts/kernel-security/proc-leaks/dac-bypass.py
17+++ b/scripts/kernel-security/proc-leaks/dac-bypass.py
18@@ -1,4 +1,7 @@
19-#!/usr/bin/env python2
20+#!/bin/sh
21+''':'
22+if which python3 > /dev/null 2>&1; then exec python3 "$0" "$@"; else exec python2 "$0" "$@"; fi
23+'''
24 # Demonstrates DAC bypass on /proc/$pid file descriptors across setuid exec
25 # Author: Kees Cook <kees@ubuntu.com>
26 # License: GPLv2
27diff --git a/scripts/kernel-security/proc-maps/maps-protection.py b/scripts/kernel-security/proc-maps/maps-protection.py
28index 6cbcf57..9fbe4b9 100755
29--- a/scripts/kernel-security/proc-maps/maps-protection.py
30+++ b/scripts/kernel-security/proc-maps/maps-protection.py
31@@ -1,4 +1,7 @@
32-#!/usr/bin/env python2
33+#!/bin/sh
34+''':'
35+if which python3 > /dev/null 2>&1; then exec python3 "$0" "$@"; else exec python2 "$0" "$@"; fi
36+'''
37 #
38 # This verifies that memory-segment listing /proc files (maps, smaps) are
39 # not world-readable, and that setuid priv-dropped process can still read
40diff --git a/scripts/test-kernel-security.py b/scripts/test-kernel-security.py
41index c855cbd..a288200 100755
42--- a/scripts/test-kernel-security.py
43+++ b/scripts/test-kernel-security.py
44@@ -1,4 +1,7 @@
45-#!/usr/bin/env python2
46+#!/bin/sh
47+''':'
48+if which python3 > /dev/null 2>&1; then exec python3 "$0" "$@"; else exec python2 "$0" "$@"; fi
49+'''
50 #
51 # kernel-security.py regression testing script for kernel and
52 # security features

Subscribers

People subscribed via source and target branches