Problem/Motivation

Coworker running composer install is getting this error:

Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2869592-remove-update-warning-7.patch
  [Exception]
  Cannot apply patch 2869592 - Disabled update module shouldn't produce a status report warning (https://www.drupal.org/files/issues/2869592-remove-update-warning-7.patch)!

This patch doesn't apply to Drupal 8.8.2.

Proposed resolution

remove or update the patch.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#4 3112055-4.patch1.02 KBoknate
#2 3112055-2.patch858 bytesoknate
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

oknate created an issue. See original summary.

oknate’s picture

Status: Active » Needs review
StatusFileSize
new858 bytes
oknate’s picture

Title: Remove patch that no longer applies » Update patch that no longer applies

Phenaproxima says the patch should be rerolled, rather than removed.

oknate’s picture

StatusFileSize
new1.02 KB

Here's a patch that updates the core patch.

oknate’s picture

Hmm, when I run it on my machine, the old patch applies:

  - Installing drupal/core (8.8.2): Downloading (100%)         
  - Applying patches for drupal/core
    https://www.drupal.org/files/issues/2869592-remove-update-warning-7.patch (2869592 - Disabled update module shouldn't produce a status report warning)

but when my coworker runs it it doesn't, and when I try to apply it directly to 8.8.2 tag on in the drupal repo on the 8.8.x branch, it doesn't.

The patches are different:

nathanandersen-mbp:pgim-server nathanandersen$ diff ~/Downloads/2869592-remove-update-warning-7.patch ~/Downloads/2869592-remove-update-warning-34.patch
1,9d0
< From c7b3da0db33803b01f3813797283821072288b94 Mon Sep 17 00:00:00 2001
< From: Jakob Perry <japerry@45640.no-reply.drupal.org>
< Date: Mon, 22 May 2017 14:04:49 -0400
< Subject: [PATCH] Issue 2869592
< 
< ---
<  core/modules/system/system.install | 2 +-
<  1 file changed, 1 insertion(+), 1 deletion(-)
< 
11c2
< index 56ce685..5daf6a8 100644
---
> index daf78612ee..dcc030d7c9 100644
14c5
< @@ -817,7 +817,7 @@ function system_requirements($phase) {
---
> @@ -948,7 +948,7 @@ function system_requirements($phase) {
22,25c13
<            ':module' => \Drupal::url('system.modules_list'),
< -- 
< 2.6.4 (Apple Git-63)
< 
---
>            ':module' => Url::fromRoute('system.modules_list')->toString(),
kentr’s picture

I'm also experiencing this problem.

In my case, I'm using vaimo/composer-patches, which chokes on the original patch (2869592-remove-update-warning-7.patch).

Bottom line is that the original patch has garbage at the end of it.

For example, note the "Hmm... Ignoring the trailing garbage" line in the output from patch (run from docroot/core):

$ curl -s 'https://www.drupal.org/files/issues/2869592-remove-update-warning-7.patch' | /usr/bin/patch -t --verbose -p'2' --no-backup-if-mismatch --dry-run 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|From c7b3da0db33803b01f3813797283821072288b94 Mon Sep 17 00:00:00 2001
|From: Jakob Perry <japerry@45640.no-reply.drupal.org>
|Date: Mon, 22 May 2017 14:04:49 -0400
|Subject: [PATCH] Issue 2869592
|
|---
| core/modules/system/system.install | 2 +-
| 1 file changed, 1 insertion(+), 1 deletion(-)
|
|diff --git a/core/modules/system/system.install b/core/modules/system/system.install
|index 56ce685..5daf6a8 100644
|--- a/core/modules/system/system.install
|+++ b/core/modules/system/system.install
--------------------------
Patching file modules/system/system.install using Plan A...
Reversed (or previously applied) patch detected!  Assuming -R.
Hunk #1 succeeded at 948 with fuzz 1 (offset 131 lines).
Hmm...  Ignoring the trailing garbage.
done

That garbage might be what's causing the patch to fail on the coworker's machine.

Workaround

  • Use vaimo/composer-patches in your project instead of cweagans/composer-patches.
  • Tell the patcher to exclude the corresponding patch in drupal/lightning_core.
  • Apply the rerolled patch (#34) in your project's composer.json.

Example code snippet for the project's composer.json:

        "patches-exclude": {
            "drupal/lightning_core": [
                "2869592-remove-update-warning-7.patch"
            ]
        },
        "patches": {
            "drupal/core": {
                "2869592 - Disabled update module shouldn't produce a status report warning": "https://www.drupal.org/files/issues/2020-02-07/2869592-remove-update-warning-34.patch"
            }
        }

With this workaround, the broken patch is skipped and composer install finishes without errors for me.

Update

Might also need to remove this line from your composer.json.

"composer-exit-on-patch-failure": true,

Composer may install cweagans/composer-patches if required by any dependencies, at least with fresh installations.

With that line in place, a failure from cweagans/composer-patches may cause composer to abort before vaimo/composer-patches ever has a chance to run.

levsoroka’s picture

I have also experienced this issue, doing --verbose argument when running composer install/update helped realze that the patch tool was not available on the host. Hence it failed upon the first patch. Not related to the actual patch.

oheller’s picture

I had a number of patches that I needed to ignore but their location moved from the lightning_core composer.json to the acquia/lightning profile at docroot/profile/contrib/lightning/composer.json.

I had to add exclude those using this in my root composer.json:

    "patches-ignore": {
            "acquia/lightning": {
                "drupal/core": {
                    "[subprofile support] 1356276 - Allow profiles to define a base/parent profile and load them in the correct order": "https://www.drupal.org/files/issues/2019-11-05/1356276-531-8.8.x-4.patch",
                    "[subprofile support] 2914389 - Allow profiles to exclude dependencies of their parent": "https://www.drupal.org/files/issues/2018-07-09/2914389-8-do-not-test.patch"
                }
            }
        },

If you are having issues ignoring a patch try and find all the locations that are adding it.

lawxen made their first commit to this issue’s fork.