Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unbounded globbing leads to "freeze" during pod install #2479

Closed
ephemer opened this issue Aug 20, 2024 · 1 comment
Closed

Unbounded globbing leads to "freeze" during pod install #2479

ephemer opened this issue Aug 20, 2024 · 1 comment

Comments

@ephemer
Copy link
Contributor

ephemer commented Aug 20, 2024

Hello, and thank you for your work on this project! 🙂

I have been trying to understand a weird bug whereby pod install no longer works for me from RN >= 0.74. It just appears to freeze and do nothing. I left it for 30mins and nothing happened.

I finally tracked this down to the npx @react-native-community/cli config call performed during install. After some log debugging it turns out the "freeze" occurs during globbing while searching for the iOS Podfile.

We have a submodule containing native code that is very deeply nested (with its own native build system, dependencies, their build artefacts, etc.). fast-glob seems to get stuck looking in that deeply nested directory structure (maybe there's even a cycle somewhere due to symlinks – I'm not sure). In any case, it seems like the most likely case by far is that Podfile can be found in ${PROJECT_ROOT}/ios/Podfile. It seems very unlikely that it will be found in a deeply nested directory somewhere – if it will be found anywhere other than that default location in the first place.

The following diff solved my problem, and I believe it'd generally be a good idea to put an upper bound on the depth of the search:

diff --git a/node_modules/@react-native-community/cli-platform-apple/build/config/findAllPodfilePaths.js b/node_modules/@react-native-community/cli-platform-apple/build/config/findAllPodfilePaths.js
index e82bcee..3d789cb 100644
--- a/node_modules/@react-native-community/cli-platform-apple/build/config/findAllPodfilePaths.js
+++ b/node_modules/@react-native-community/cli-platform-apple/build/config/findAllPodfilePaths.js
@@ -32,7 +32,8 @@ const GLOB_EXCLUDE_PATTERN = ['**/@(Pods|node_modules|Carthage|vendor)/**'];
 function findAllPodfilePaths(cwd) {
   return _fastGlob().default.sync('**/Podfile', {
     cwd: (0, _cliTools().unixifyPaths)(cwd),
-    ignore: GLOB_EXCLUDE_PATTERN
+    ignore: GLOB_EXCLUDE_PATTERN,
+    deep: 10,
   });
 }
 
@szymonrybczak
Copy link
Collaborator

Fixed by: #2480

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants