From 9e169da3ae44854e0cbfe6d95739a669290105c8 Mon Sep 17 00:00:00 2001 From: Gabriel Rogan <58148287+gaberogan@users.noreply.github.com> Date: Tue, 30 Aug 2022 04:10:10 -0700 Subject: [PATCH] fix: "Time.h:52:17: error: typedef redefinition with different types" when a folder in the file path has a space (#34510) Summary: The `sed` workaround here in `__apply_Xcode_12_5_M1_post_install_workaround`: https://github.com/facebook/react-native/blob/main/scripts/react_native_pods.rb#L293-L298 does not work when the react native project has a parent folder with a space in the the name, for example: `/Users/myuser/Some Folder/my-project/ios/Pods/RCT-Folly/folly/portability/Time.h` This is because the `sed` command thinks that the part after the space is a separate argument. This bug caused one of our engineers to not be able to run our React Native project through no fault of his own, so I would like to propose this change to help other engineers avoid this in the future. ## Changelog Add single quotes around the file parameter in the `sed` command [iOS] [Fixed] - Fixed Time.h:52:17: error when a folder in the file path has a space Pull Request resolved: https://github.com/facebook/react-native/pull/34510 Test Plan: Checkout the main branch. Create a React Native project in a folder that has a space in the name. When you run `pod install`, you should notice a `sed` error indicating that the text replacement failed. Run the build to reproduce the `Time.h:52:17: error`. Checkout this branch. Run `pod install` and notice the `sed` error is gone. Run the build, the error should be gone. Reviewed By: sammy-SC Differential Revision: D39082262 Pulled By: cipolleschi fbshipit-source-id: 211099234edc6c9ee959bb61a760a6ca04a7a301 --- scripts/react_native_pods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/react_native_pods.rb b/scripts/react_native_pods.rb index 669a71130d1bca..f5088affeb379d 100644 --- a/scripts/react_native_pods.rb +++ b/scripts/react_native_pods.rb @@ -295,5 +295,5 @@ def __apply_Xcode_12_5_M1_post_install_workaround(installer) # We need to make a patch to RCT-Folly - remove the `__IPHONE_OS_VERSION_MIN_REQUIRED` check. # See https://github.com/facebook/flipper/issues/834 for more details. time_header = "#{Pod::Config.instance.installation_root.to_s}/Pods/RCT-Folly/folly/portability/Time.h" - `sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' #{time_header}` + `sed -i -e $'s/ && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_10_0)//' '#{time_header}'` end