ds300 / ds300/patch-package

(bug) Patch made on macOS fails to apply on Ubuntu (Codeship CI)

Open
#332 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

Hi there, this is a re-opening of #147. I have just experienced the same issue as the original poster.

I made a patch on macOS that successfully applied on multiple developers' machines. However, the patch failed to run on our Ubuntu Codeship CI.

I SSHed into the CI and made the patch again on Ubuntu, and now, this patch works on both the CI and macOS.

Take a look at the diff between the two patches. Red is macOS, green is Ubuntu.
```diff
diff --git a/patches/@react-native-firebase+messaging+12.1.0.patch b/patches/@react-native-firebase+messaging+12.1.0.patch
index 29f591e..95f354c 100644
--- a/patches/@react-native-firebase+messaging+12.1.0.patch
+++ b/patches/@react-native-firebase+messaging+12.1.0.patch
@@ -2,7 +2,7 @@ diff --git a/node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNF
index 541114d..ef91b68 100644
--- a/node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m
+++ b/node_modules/@react-native-firebase/messaging/ios/RNFBMessaging/RNFBMessaging+UNUserNotificationCenter.m
-@@ -69,9 +69,9 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNot
+@@ -69,9 +69,9 @@ struct {

// Don't send an event if contentAvailable is true - application:didReceiveRemoteNotification will send the event
// for us, we don't want to duplicate them
@@ -15,7 +15,7 @@ index 541114d..ef91b68 100644

// TODO in a later version allow customising completion options in JS code
completionHandler(UNNotificationPresentationOptionNone);
-@@ -88,8 +88,18 @@ - (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNoti
+@@ -88,8 +88,18 @@ struct {
NSDictionary *remoteNotification = response.notification.request.content.userInfo;
if (remoteNotification[@"gcm.message_id"]) {
NSDictionary *notificationDict = [RNFBMessagingSerializer remoteMessageUserInfoToDict:remoteNotification];
```

I will include the full patches in the next comment.

## Hypothesis

Based on the identical changes to the file but different patch result, I suppose there is an inconsistency between `patch-package` on the two operating systems leading to this.

## Environment

The original file being patched:

https://github.com/invertase/react-native-firebase/blob/master/packages/messaging/ios/RNFBMessaging/RNFBMessaging%2BUNUserNotificationCenter.m

*Note the inclusion of `struct` in the diff which is from much higher up in the file, around line 24.*

On both operating systems I am using `npx patch-package` which is executing version `6.2.2`.

Git version is `2.32.0` on both operating systems.

Ubuntu version:
```
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.5 LTS
Release: 18.04
Codename: bionic
```

macOS version:
```
~ » sw_vers
ProductName: macOS
ProductVersion: 11.4
BuildVersion: 20F71
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.