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

Composer patches not applied successfully #3474

Closed
ma4nn opened this issue Aug 29, 2023 · 5 comments · Fixed by #3475
Closed

Composer patches not applied successfully #3474

ma4nn opened this issue Aug 29, 2023 · 5 comments · Fixed by #3475

Comments

@ma4nn
Copy link
Contributor

ma4nn commented Aug 29, 2023

Preconditions (*)

  1. OpenMage 20.1.0
  2. PHP 8.1
  3. Mac Ventura 13.4.1

Steps to reproduce (*)

  1. Setup clean OpenMage project according to instructions, especially enabling composer patches

Expected result (*)

  1. Composer patches should be applied successfully with e.g. composer install

Actual result (*)

  1. Applying composer patches for shardj/zf1-future fail with error:
  - Applying patches for shardj/zf1-future
    https://raw.githubusercontent.com/OpenMage/composer-patches/74862e7a9fa29dd62c5c02d585d931ce9e3c5815/patches/MAG-1.1.1.patch (MAG-1.1.1)
patch '-p1' --no-backup-if-mismatch -d '/var/www/vendor/shardj/zf1-future' < '/var/folders/bw/lwdvq1d17lz45m5mb4677vqm0000gn/T/64ed951f11b24.patch'
patching file 'library/Zend/Mime.php'
Patch creates file that already exists!  Assume -R? [y]

Imho the issue occurs because all patches use /dev/null as base which according to patch man-page try to create a new file:

you can create a file by sending out a diff that compares a null file to the file you want to create. If the file you want to create already exists in the target directory when the diff is applied, then patch will identify the patch as potentially reversed and offer to reverse the patch.

@fballiano
Copy link
Contributor

on mac you've to install gpatch because the macOS patch is differente somehow

@ma4nn
Copy link
Contributor Author

ma4nn commented Aug 29, 2023

@fballiano yes you're right brew install gpatch && brew link gpatch --force --overwrite fixed the issue, thanks 🥳 And it is also mentioned already in the OM requirements - shame on me 🙈

After this fix only 2 patches are still failing to apply:

  1. MAG-1.9.3.9.patch
  2. OM-ZF1F-344.patch

-> both seem to be already merged into shardj/zf1-future

Perhaps it would make sense to use another composer patches plugin such as vaimo/composer-patches that can handle version constraints for the patches?

@ma4nn ma4nn closed this as completed Aug 29, 2023
@fballiano
Copy link
Contributor

Unoess you ran composer upgrade umyou shouldnt ran into this problem no?

@ma4nn
Copy link
Contributor Author

ma4nn commented Aug 29, 2023

I see, this issue has already been raised in #3445.

But as OpenMage has "shardj/zf1-future": "^1.22" as dependency, when you do a fresh OM install you always get the latest version 1.23.5 of shardj/zf1-future which conflicts with those 2 patches.

@fballiano
Copy link
Contributor

totally right, I've created #3475 to specify the exact version number so that this kind of situation shouldn't present anymore in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants