composer-patches: Can't patch after update to MacOS Ventura
I am not sure if this is actually an issue of this package or if it is caused somewhere else. Does anyone else has the problem, that while applying a patch (on MacOs Ventura) the process runs into a timeout? This happens only since the recent update.
After hanging on “File to patch” the following error is thrown:
File to patch:
Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d '/Users/mrl/Repositories/m2-composer-base/vendor/amasty/module-gift-card-account' < '/Users/mrl/Repositories/m2-composer-base/patches/composer/Amasty_GiftCardAccount_Fixes.patch'" exceeded the timeout of 300 seconds.
Downloading https://packagist.org/downloads/
[201] https://packagist.org/downloads/
[Exception]
Cannot apply patch Fixed amasty broken namespaces (AMO-783) (patches/composer/Amasty_GiftCardAccount_Fixes.patch)!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 14
- Comments: 47 (7 by maintainers)
Links to this issue
Commits related to this issue
- Fix #423: Patching stalls on Ventura — committed to danepowell/composer-patches by danepowell a year ago
On that note, what seemed to fix this for me with additional testing was installing the gnu patch via homebrew. (https://formulae.brew.sh/formula/gpatch)
brew install gpatchwhich installs patchGNU patch 2.7.6After which, no issues with patches applying, including the one that failed for @dpi
@mikeohara solution from https://github.com/cweagans/composer-patches/issues/423#issuecomment-1301026697 is fixing the issue. Thank you!
Related: https://github.com/cweagans/composer-patches/issues/326 — so you need
brew install gpatchalready anyway.PR to check it: https://github.com/cweagans/composer-patches/pull/426
Last followup on this, this can be corrected fully by ensuring you are using the
patchLeveldirective in the extras section of your composer.json:Adding that corrected the stall, and correctly applied core and contrib patches.
For me the
brew install gpatchsolved all patching errors after updating to macOS VenturaI also tried with the -v (–verbose) flag, and it didn’t stall then either.
Seems almost as if specifying any flag will “just make it work”.As I was writing this, I decided to try a couple of things. I
rm -rf’d my web/core and web/contrib folders and kept re-running the composer install to see where it fell down. In my case, it started to fail on applying patches to drupal/core. Where it would stall and ask for the “File to patch”:and trying to step through it with the enter key results like so:
It seems like something has changed with perhaps the patch binary being used and currently rolled patches that is now causing an issue with it no longer being able to find the patch file locations in some cases. Example of a now-failing patch: https://www.drupal.org/files/issues/2022-07-24/2949017-99.patch
For reference, I’m including a screenshot of the successful patch action during composer run, if useful.
I have had this exact issue as well. I found by accident spamming the enter key while it runs works. So it seems like there is a user input that may be being suppressed.
I have found that adding the -n (–no-interaction) flag allows patches to apply just fine.
Please try the 2.0.0 beta and see if it works for you. You can also install GNU patch (brew install gpatch).
You’re welcome to debug further and open a pull request if needed as well. Contributions are welcome.