Skip to content

Commit 3ad9316

Browse files
authored
gh-162034: Quote paths in the Apple testbed's utils.sh (#162161)
Add additional protection against spaces and other special characters in iOS Xcode build scripts.
1 parent 715d34f commit 3ad9316

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
@@ -101,9 +101,9 @@ install_dylib () {
101101
MODULE_PATH=$(dirname "$FULL_EXT")
102102
MODULE_NAME=$(echo $EXT | cut -d "." -f 1)
103103
# The location of the extension file, relative to the bundle
104-
RELATIVE_EXT=${FULL_EXT#$CODESIGNING_FOLDER_PATH/}
104+
RELATIVE_EXT=${FULL_EXT#"$CODESIGNING_FOLDER_PATH"/}
105105
# The path to the extension file, relative to the install base
106-
PYTHON_EXT=${RELATIVE_EXT/$INSTALL_BASE/}
106+
PYTHON_EXT=${RELATIVE_EXT/"$INSTALL_BASE"/}
107107
# The full dotted name of the extension module, constructed from the file path.
108108
FULL_MODULE_NAME=$(echo $PYTHON_EXT | cut -d "." -f 1 | tr "/" ".");
109109
# A bundle identifier; not actually used, but required by Xcode framework packaging
@@ -152,8 +152,8 @@ install_dylib () {
152152
process_dylibs () {
153153
PYTHON_XCFRAMEWORK_PATH=$1
154154
LIB_PATH=$2
155-
find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read FULL_EXT; do
156-
install_dylib $PYTHON_XCFRAMEWORK_PATH "$LIB_PATH/" "$FULL_EXT"
155+
find "$CODESIGNING_FOLDER_PATH/$LIB_PATH" -name "*.so" | while read -r FULL_EXT; do
156+
install_dylib "$PYTHON_XCFRAMEWORK_PATH" "$LIB_PATH/" "$FULL_EXT"
157157
done
158158
}
159159

@@ -168,13 +168,13 @@ install_python() {
168168
PYTHON_XCFRAMEWORK_PATH=$1
169169
shift
170170

171-
install_stdlib $PYTHON_XCFRAMEWORK_PATH
171+
install_stdlib "$PYTHON_XCFRAMEWORK_PATH"
172172
PYTHON_VER=$(ls -1 "$CODESIGNING_FOLDER_PATH/python/lib" | grep -E "^python3\.\d+[a-z]*$")
173173
echo "Install Python $PYTHON_VER standard library extension modules..."
174-
process_dylibs $PYTHON_XCFRAMEWORK_PATH python/lib/$PYTHON_VER/lib-dynload
174+
process_dylibs "$PYTHON_XCFRAMEWORK_PATH" python/lib/$PYTHON_VER/lib-dynload
175175

176-
for package_path in $@; do
176+
for package_path in "$@"; do
177177
echo "Installing $package_path extension modules ..."
178-
process_dylibs $PYTHON_XCFRAMEWORK_PATH $package_path
178+
process_dylibs "$PYTHON_XCFRAMEWORK_PATH" "$package_path"
179179
done
180180
}

0 commit comments

Comments
 (0)