Skip to content

Commit 8a2f61d

Browse files
fametranofreakboy3742
authored andcommitted
[3.15] gh-162034: Quote paths in the Apple testbed's utils.sh (GH-162161)
Add additional protection against spaces and other special characters in iOS Xcode build scripts. (cherry picked from commit 3ad9316) Co-authored-by: Ferdinando Ametrano <fametrano@users.noreply.github.com>
1 parent 094f7fe commit 8a2f61d

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix the Apple testbed's extension module processing for an XCframework or
2+
package path with a space, or a build path with brackets or a backslash.

‎Platforms/Apple/testbed/Python.xcframework/build/utils.sh‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ install_dylib () {
7272
MODULE_PATH=$(dirname "$FULL_EXT")
7373
MODULE_NAME=$(echo $EXT | cut -d "." -f 1)
7474
# The location of the extension file, relative to the bundle
75-
RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}
75+
RELATIVE_EXT=${FULL_EXT#"$CODESIGNING_FOLDER_PATH"/}
7676
# The path to the extension file, relative to the install base
77-
PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}
77+
PYTHON_EXT=${RELATIVE_EXT/"$INSTALL_BASE"/}
7878
# The full dotted name of the extension module, constructed from the file path.
7979
FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d "." -f 1 | tr "/" ".");
8080
# A bundle identifier; not actually used, but required by Xcode framework packaging
@@ -123,8 +123,8 @@ install_dylib () {
123123
process_dylibs () {
124124
PYTHON_XCFRAMEWORK_PATH=$1
125125
LIB_PATH=$2
126-
find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read FULL_EXT; do
127-
install_dylib $PYTHON_XCFRAMEWORK_PATH "$LIB_PATH/" "$FULL_EXT"
126+
find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read -r FULL_EXT; do
127+
install_dylib "$PYTHON_XCFRAMEWORK_PATH" "$LIB_PATH/" "$FULL_EXT"
128128
done
129129
}
130130

@@ -139,13 +139,13 @@ install_python() {
139139
PYTHON_XCFRAMEWORK_PATH=$1
140140
shift
141141

142-
install_stdlib $PYTHON_XCFRAMEWORK_PATH
142+
install_stdlib "$PYTHON_XCFRAMEWORK_PATH"
143143
PYTHON_VER=$(ls -1 "$CODESIGNING_FOLDER_PATH/python/lib" | grep -E "^python3\.\d+$")
144144
echo "Install Python $PYTHON_VER standard library extension modules..."
145-
process_dylibs $PYTHON_XCFRAMEWORK_PATH python/lib/$PYTHON_VER/lib-dynload
145+
process_dylibs "$PYTHON_XCFRAMEWORK_PATH" python/lib/$PYTHON_VER/lib-dynload
146146

147-
for package_path in $@; do
147+
for package_path in "$@"; do
148148
echo "Installing $package_path extension modules ..."
149-
process_dylibs $PYTHON_XCFRAMEWORK_PATH $package_path
149+
process_dylibs "$PYTHON_XCFRAMEWORK_PATH" "$package_path"
150150
done
151151
}

0 commit comments

Comments
 (0)