composer-patches icon indicating copy to clipboard operation
composer-patches copied to clipboard

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

Open arcanumbridge opened this issue 3 years ago • 1 comments

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

arcanumbridge avatar Apr 03 '22 05:04 arcanumbridge

👍 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 :)

mfb avatar Apr 10 '22 19:04 mfb

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

arcanumbridge avatar Jan 27 '23 01:01 arcanumbridge

@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 avatar Jan 27 '23 03:01 mfb

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 avatar Jan 27 '23 03:01 mfb

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

mfb avatar Feb 02 '23 02:02 mfb

@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 avatar Feb 04 '23 06:02 cweagans

(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)

cweagans avatar Feb 04 '23 06:02 cweagans

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.

danepowell avatar Feb 04 '23 15:02 danepowell

@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.

arcanumbridge avatar Feb 04 '23 16:02 arcanumbridge

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 avatar Feb 06 '23 01:02 cweagans