Skip to content

Commit

Permalink
fix: "Time.h:52:17: error: typedef redefinition with different types"…
Browse files Browse the repository at this point in the history
… 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: #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
  • Loading branch information
gaberogan authored and facebook-github-bot committed Aug 30, 2022
1 parent 3afef3c commit 9e169da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 9e169da

Please sign in to comment.