Skip to content

Commit 27b5f76

Browse files
etodanikmeta-codesync[bot]
authored andcommitted
avoid copying extended file attributes when inside virtiofs (#57555)
Summary: I'm doing CI/CD that includes React Native inside of https://tart.run/. Tart uses Apple Virtualization Framework, which in turn mounts VirtioFS volumes. This feels like a common enough use case to contribute upstream, since I can envision many more people using Apple's virtualization features. ## Changelog: [GENERAL] [FIXED] - react-native-codegen build.sh on AppleVirtIOFS volumes Pull Request resolved: #57555 Test Plan: Run `packages/react-native-codegen/scripts/oss/build.sh` inside a virtual machine that uses Apple Virtualization Framework such as Tart Reviewed By: cipolleschi Differential Revision: D112091671 Pulled By: cortinico fbshipit-source-id: 800e6ac54175aaf7a9dfb4b99950cbc6da86e085
1 parent de778b9 commit 27b5f76

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • packages/react-native-codegen/scripts/oss

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,20 @@ fi
2424
YARN_BINARY="${YARN_BINARY:-$YARN_OR_NPM}"
2525

2626
# mv command to use when copying files into the working directory
27-
EDEN_SAFE_MV="mv"
27+
SAFE_MV="mv"
28+
29+
# Detect if we are on a VirtioFS volume via Apple Virtualization.framework
30+
if [[ "$OSTYPE" == "darwin"* ]] && /sbin/mount | /usr/bin/awk -v dev="$(/bin/df -P "$CODEGEN_DIR" | /usr/bin/awk 'NR==2 {print $1}')" '$1 == dev && /AppleVirtIOFS/ { found=1 } END { exit !found }'; then
31+
SAFE_MV="/bin/cp -R -X"
32+
fi
2833

2934
if [ -x "$(command -v eden)" ]; then
3035
pushd "$THIS_DIR"
3136

3237
# Detect if we are in an EdenFS checkout with `eden info` (we ignore the output as it creates noise on CI/IDE logs)
3338
# Also be sure to use /bin/cp in case users have GNU coreutils installed which is incompatible with -X
3439
if [[ "$OSTYPE" == "darwin"* ]] && eden info 2>/dev/null; then
35-
EDEN_SAFE_MV="/bin/cp -R -X"
40+
SAFE_MV="/bin/cp -R -X"
3641
fi
3742

3843
popd >/dev/null
@@ -71,7 +76,7 @@ else
7176

7277
popd >/dev/null
7378

74-
$EDEN_SAFE_MV "$TMP_DIR/lib" "$CODEGEN_DIR"
75-
$EDEN_SAFE_MV "$TMP_DIR/node_modules" "$CODEGEN_DIR"
79+
$SAFE_MV "$TMP_DIR/lib" "$CODEGEN_DIR"
80+
$SAFE_MV "$TMP_DIR/node_modules" "$CODEGEN_DIR"
7681
rm -rf "$TMP_DIR"
7782
fi

0 commit comments

Comments
 (0)