Skip to content

Commit e079953

Browse files
blakeffacebook-github-bot
authored andcommitted
Fix: OSS builds can accidentally using coreutils cp (#44097)
Summary: Pull Request resolved: #44097 There are two places where we use a feature specific to the system version of 'cp', the: -X Do not copy Extended Attributes (EAs) or resource forks. This feature isn't available in GNU's cp, which is commonly installed on macOS using: brew install coreutils && brew link coreutils We can avoid the problem alltogether by being specific about the path of the system cp. Changelog: [General][Fixed] don't break script phase and codegen when coreutils installed on macOS Reviewed By: cipolleschi Differential Revision: D56143216 fbshipit-source-id: f1c1ef9ea2f01614d6d89c4e9eedf43113deb80c
1 parent 1d26907 commit e079953

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

packages/react-native-codegen/scripts/oss/build.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ EDEN_SAFE_MV="mv"
2929
if [ -x "$(command -v eden)" ]; then
3030
pushd "$THIS_DIR"
3131

32-
# Detect if we are in an EdenFS checkout
32+
# Detect if we are in an EdenFS checkout, but be sure to use /bin/cp
33+
# incase users have GNU coreutils installed which is incompatible with -X
3334
if [[ "$OSTYPE" == "darwin"* ]] && eden info; then
34-
EDEN_SAFE_MV="cp -R -X"
35+
EDEN_SAFE_MV="/bin/cp -R -X"
3536
fi
3637

3738
popd >/dev/null
@@ -60,7 +61,7 @@ else
6061
if [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ]; then
6162
tar cf - --exclude='*.lock' "$CODEGEN_DIR" | (cd "$TMP_DIR" && tar xvf - );
6263
else
63-
cp -R "$CODEGEN_DIR/." "$TMP_DIR";
64+
/bin/cp -R "$CODEGEN_DIR/." "$TMP_DIR";
6465
fi
6566

6667
pushd "$TMP_DIR" >/dev/null

packages/react-native/scripts/react_native_pods_utils/script_phases.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ moveOutputs () {
104104
mkdir -p "$RCT_SCRIPT_OUTPUT_DIR"
105105

106106
# Copy all output to output_dir
107-
cp -R -X "$TEMP_OUTPUT_DIR/." "$RCT_SCRIPT_OUTPUT_DIR" || exit 1
107+
/bin/cp -R -X "$TEMP_OUTPUT_DIR/." "$RCT_SCRIPT_OUTPUT_DIR" || exit 1
108108
echo "$LIBRARY_NAME output has been written to $RCT_SCRIPT_OUTPUT_DIR:" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
109109
ls -1 "$RCT_SCRIPT_OUTPUT_DIR" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1
110110
}

0 commit comments

Comments
 (0)