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

Fix Issue #401 - correctly apply multiple command line parameter flags for FreeBSD #402

Closed
wants to merge 13 commits into from

Conversation

arcanumbridge
Copy link

This is a fix for issue #401 to individually escape the flags to patch.

src/Plugin/Patches.php Outdated Show resolved Hide resolved
@mfb
Copy link

mfb commented Apr 10, 2022

👍 Tested on FreeBSD, it now runs patch '-p2' '--posix' '--batch' -d 'web/core' < '/tmp//6253330a8bb7f.patch'

(I do see a mix of code styles e.g. foreach( and if( vs foreach ( and if ( - not sure if this package has code style preferences or not :)

Copy link

@grappler grappler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just tested the patch and can confirm it is working as expected.

An alternative to the nested if statement would be to use continue instead, like I did here: wearerequired@d1a08bd

@arcanumbridge arcanumbridge requested a review from mfb January 25, 2023 21:34
Copy link

@mfb mfb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested again on FreeBSD and still working fine - it executes patch '-p1' '--posix' '--batch' rather than the broken patch '-p1' '--posix --batch'

Now I guess we need an actual maintainer to review :)

@arcanumbridge
Copy link
Author

@cweagans @danepowell can we get a maintainer to review and merge this? This fixes FreeBSD support.

@mfb
Copy link

mfb commented Jan 27, 2023

@arcanumbridge I found some other issues mentioning non-GNU patch also being broken on macOS. I'm not sure if macOS uses "BSD" as PHP_OS_FAMILY or something else? If "BSD," then hopefully this PR also fixes macOS. If something else, then maybe this code should be checking whether or not patch is GNU patch rather than looking at the operating system family.

@mfb
Copy link

mfb commented Jan 27, 2023

Realized I could just check the php source code :) Looks like macOS uses "Darwin" as the PHP_OS_FAMILY, so this PR won't help there. But, could we tweak the logic to check if patch --version is not GNU patch? See #426 for a way to check this. And if not GNU patch, apply the BSD options.

@mfb
Copy link

mfb commented Feb 2, 2023

@arcanumbridge should we roll this back to the version that I tested, with BSD OS-specific logic?

@cweagans
Copy link
Owner

cweagans commented Feb 4, 2023

@mfb Can you please take a look at #447 (in particular, src/Patcher/*) and let me know if I've captured what needs captured?

@cweagans
Copy link
Owner

cweagans commented Feb 4, 2023

(for context, 2.x is essentially a rewrite and it breaks a ton of things out of the main plugin so that they're individually testable)

@danepowell
Copy link
Collaborator

I don't have time to test it this weekend, but I like #447 and it looks like it should fix the issue. I like that the patch providers are more structured and test the patch version directly instead trying to infer it based on OS info.

@arcanumbridge
Copy link
Author

@cweagans I've made a few comments regarding some consistency of using ->patchTool() and testing for gpatch, but I think it essentially captures what we want.

@cweagans
Copy link
Owner

cweagans commented Feb 6, 2023

Great! I'm going to close this then and focus on getting 2.x out the door as quickly as possible.

(also thank you for the review -- super helpful)

@cweagans cweagans closed this Feb 6, 2023
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

Successfully merging this pull request may close these issues.

5 participants