Skip to content

Commit 39d4c9c

Browse files
authored
Merge pull request #9 from anki-code/master
Sanitizing of local Python scripts corrupt the exec command
2 parents 34a4a67 + beef8b0 commit 39d4c9c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

linuxdeploy-plugin-python.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ HOME="${PYTHON_BUILD_DIR}" make -j"$NPROC" DESTDIR="$APPDIR" install
129129
if [ ! -z "${PIP_REQUIREMENTS}" ]; then
130130
cd "${APPDIR}/${prefix}/bin"
131131
pythons=( "python"?"."? )
132+
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install --upgrade pip
132133
HOME="${PYTHON_BUILD_DIR}" PYTHONHOME=$(readlink -f ${PWD}/..) ./${pythons[0]} -m pip install ${PIP_OPTIONS} ${PIP_REQUIREMENTS}
133134
fi
134135

@@ -162,7 +163,7 @@ cd "$APPDIR/${prefix}/bin"
162163
for exe in $(ls "${APPDIR}/${prefix}/bin"*)
163164
do
164165
if [[ -f "$exe" ]] && [[ -x "$exe" ]]; then
165-
sed -i '1s|^#!.*\(python[0-9.]*\)|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
166+
sed -i '1s|^#!.*\(python[0-9.]*\).*|#!/bin/sh\n"exec" "$(dirname $(readlink -f $\{0\}))/../../bin/\1" "$0" "$@"|' "$exe"
166167
fi
167168
done
168169

0 commit comments

Comments
 (0)