Skip to content

Commit a456e8f

Browse files
authored
Use an array for cross-platform sed args to avoid unexpected shell expansion (#520)
Closes #519
1 parent 67c3fe7 commit a456e8f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cpython-unix/build-cpython.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ export trailer_m4=${TOOLS_PATH}/host/share/autoconf/autoconf/trailer.m4
3434
# The share/autoconf/autom4te.cfg file also hard-codes some paths. Rewrite
3535
# those to the real tools path.
3636
if [ "${PYBUILD_PLATFORM}" = "macos" ]; then
37-
sed_args="-i '' -e"
37+
sed_args=(-i '' -e)
3838
else
39-
sed_args="-i"
39+
sed_args=(-i)
4040
fi
4141

42-
sed ${sed_args} "s|/tools/host|${TOOLS_PATH}/host|g" ${TOOLS_PATH}/host/share/autoconf/autom4te.cfg
42+
sed "${sed_args[@]}" "s|/tools/host|${TOOLS_PATH}/host|g" ${TOOLS_PATH}/host/share/autoconf/autom4te.cfg
4343

4444
# We force linking of external static libraries by removing the shared
4545
# libraries. This is hacky. But we're building in a temporary container
@@ -1094,7 +1094,7 @@ fi
10941094
# Don't hard-code the build-time prefix into the pkg-config files. See
10951095
# the description of `pcfiledir` in `man pkg-config`.
10961096
find ${ROOT}/out/python/install/lib/pkgconfig -name \*.pc -type f -exec \
1097-
sed ${sed_args} 's|^prefix=/install|prefix=${pcfiledir}/../..|' {} +
1097+
sed "${sed_args[@]}" 's|^prefix=/install|prefix=${pcfiledir}/../..|' {} +
10981098

10991099
mkdir ${ROOT}/out/python/licenses
11001100
cp ${ROOT}/LICENSE.*.txt ${ROOT}/out/python/licenses/

0 commit comments

Comments
 (0)