Skip to content

Commit 922b3e8

Browse files
committed
Sanitize script arguments
See tox-dev/tox#1463 for details.
1 parent c9e6f8d commit 922b3e8

File tree

6 files changed

+31
-22
lines changed

6 files changed

+31
-22
lines changed

.travis/custom.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
# This script is executed with two arguments passed to it:
55
#
6-
# $1 - full path to environment python (python used inside virtual
7-
# environment created by tox)
8-
# $2 - full path to system python (python 3.x installed on the system)
6+
# $1 - path to environment python (python used inside virtual environment
7+
# created by tox)
8+
# $2 - path to system python (python 3.x installed on the system)
99

1010
set -e
1111

@@ -17,8 +17,9 @@ TOPDIR=$(readlink -f ${SCRIPTDIR}/..)
1717
. ${SCRIPTDIR}/utils.sh
1818
. ${SCRIPTDIR}/config.sh
1919

20-
ENVPYTHON=$1
21-
SYSPYTHON=$2
20+
# Sanitize arguments (see https://github.com/tox-dev/tox/issues/1463):
21+
ENVPYTHON=$(readlink -f $1)
22+
SYSPYTHON=$(readlink -f $2)
2223
shift 2
2324

2425
# Write your custom commands here that should be run when `tox -e custom`:

.travis/runblack.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: MIT
33

4-
# Run black (the Python formatter). The first script argument is a full path
5-
# to Python interpreter, the rest of arguments are passed to black.
4+
# Run black (the Python formatter). The first script argument is a path to
5+
# Python interpreter, the rest of arguments are passed to black.
66

77
# Environment variables:
88
#
@@ -31,7 +31,9 @@ if [[ "${RUN_BLACK_DISABLED}" ]]; then
3131
exit 0
3232
fi
3333

34-
ENVPYTHON=$1
34+
# Sanitize path in case if running within tox (see
35+
# https://github.com/tox-dev/tox/issues/1463):
36+
ENVPYTHON=$(readlink -f $1)
3537
shift
3638

3739
DEFAULT_INCLUDE='^[^.].*\.py$'

.travis/runcoveralls.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# Report coverage results using coveralls. The script is executed with these
55
# parameters:
66
#
7-
# $1 - full path to environment python
8-
# $2 - full path to system python
7+
# $1 - path to environment python
8+
# $2 - path to system python
99
#
1010
# coveralls is executed only if $1 coincides with $2 and $1's environment is
1111
# stable, i.e. TRAVIS_PYTHON_VERSION is of the form [:digit:] "." [:digit:]
@@ -32,8 +32,9 @@ if [[ -z "${LSR_PUBLISH_COVERAGE}" ]]; then
3232
exit 0
3333
fi
3434

35-
ENVPYTHON=$1
36-
SYSPYTHON=$2
35+
# Sanitize arguments (see https://github.com/tox-dev/tox/issues/1463):
36+
ENVPYTHON=$(readlink -f $1)
37+
SYSPYTHON=$(readlink -f $2)
3738
shift 2
3839

3940
if lsr_compare_pythons ${ENVPYTHON} -ne ${SYSPYTHON}; then

.travis/runflake8.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: MIT
33

4-
# Run flake8. The first script argument is a full path to Python interpreter,
5-
# the rest of arguments are passed to flake8.
4+
# Run flake8. The first script argument is a path to Python interpreter, the
5+
# rest of arguments are passed to flake8.
66

77
# Environment variables:
88
#
@@ -23,7 +23,9 @@ if [[ "${RUN_FLAKE8_DISABLED}" ]]; then
2323
exit 0
2424
fi
2525

26-
ENVPYTHON=$1
26+
# Sanitize path in case if running within tox (see
27+
# https://github.com/tox-dev/tox/issues/1463):
28+
ENVPYTHON=$(readlink -f $1)
2729
shift
2830

2931
set -x

.travis/runpytest.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/bin/bash
22
# SPDX-License-Identifier: MIT
33

4-
# Wrapper around pytest. First argument is a full path to environment python,
5-
# the rest of arguments are passed to pytest.
4+
# Wrapper around pytest. First argument is a path to environment python, the
5+
# rest of arguments are passed to pytest.
66

77
set -e
88

@@ -18,7 +18,9 @@ if [[ ! -d ${TOPDIR}/tests/unit ]]; then
1818
exit 0
1919
fi
2020

21-
ENVPYTHON=$1
21+
# Sanitize path in case if running within tox (see
22+
# https://github.com/tox-dev/tox/issues/1463):
23+
ENVPYTHON=$(readlink -f $1)
2224
shift
2325

2426
PYTEST_OPTS=()

.travis/runsyspycmd.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
# to system python libraries, especially C bindings. The script is run with
66
# these arguments:
77
#
8-
# $1 - full path to environment python
9-
# $2 - full path to system python
8+
# $1 - path to environment python
9+
# $2 - path to system python
1010
# $3 - command runnable in Python (should be present in $PATH)
1111
# ${@:4} - arguments passed to $3
1212

@@ -23,8 +23,9 @@ TOPDIR=$(readlink -f ${SCRIPTDIR}/..)
2323
# Run user defined hook from .travis/config.sh.
2424
lsr_runsyspycmd_hook "$@"
2525

26-
ENVPYTHON=$1
27-
SYSPYTHON=$2
26+
# Sanitize arguments (see https://github.com/tox-dev/tox/issues/1463):
27+
ENVPYTHON=$(readlink -f $1)
28+
SYSPYTHON=$(readlink -f $2)
2829
shift 2
2930

3031
if lsr_compare_pythons ${ENVPYTHON} -ne ${SYSPYTHON}; then

0 commit comments

Comments
 (0)