6

Since my update to the new OSX (Ventura 13) I'm having problems using composer. The biggest problem I have is that my patches aren't patched and end up with and exceeded the timeout of 300 seconds after a while. I didn't change my composer.json file or the patches. This only occurs on my local site, the remote sites run smoothly.

What I tried to fix this is updating and reinstalling composer. I'm running composer 2.4.4. at the moment.

A regular composer update or composer install works like it should except when I have patches added to the composer.json file. I gets stuck running the patch.

When I do ctrl+c a few times the patch is being patched but is not added to the composer.lock file. I add it to the lock file by hand to have everything working but I want to fix this so I don't have to hack to get everything like it should.

I tried composer install -v but I'm not getting any further. The out put is as follows:

patch '-p1' --no-backup-if-mismatch -d 'public_html/core' < '/var/folders/k0/fk82ww894lvcgdkm2485dyww0000gn/T/638dea49da104.patch'
Executing command (CWD): patch '-p1' --no-backup-if-mismatch -d 'public_html/core' < '/var/folders/k0/fk82ww894lvcgdkm2485dyww0000gn/T/638dea49da104.patch'
File to patch: 
   Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d 'public_html/core' < '/var/folders/k0/fk82ww894lvcgdkm2485dyww0000gn/T/638dea49da104.patch'" exceeded the timeout of 300 seconds.

One other thing I've noticed is that since the update I get this kind of messages: composer/installers contains a Composer plugin which is currently not in your allow-plugins config. See https://getcomposer.org/allow-plugins Do you trust "composer/installers" to execute code and wish to enable it now? (writes "allow-plugins" to composer.json)

Because of this I looked at my composer file to see if the patch plugin is added and it is.

"allow-plugins": {
            "composer/installers": true,
            "drupal/console-extend-plugin": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true
        }

What can I do to find out why the patch is not running and giving me a timeout? And has s the allowed-plugin part anything to do with this?

The full composer.json file contains:

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ],
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal/addanother": "^1.1",
        "drupal/admin_toolbar": "^3.0",
        "drupal/advagg": "^4.0",
        "drupal/animated_gif": "^1.1",
        "drupal/antibot": "^2.0",
        "drupal/console": "^1.0.2",
        "drupal/core": "^9.0",
        "drupal/core-composer-scaffold": "^9",
        "drupal/core-project-message": "^9",
        "drupal/core-recommended": "^9",
        "drupal/ctools": "^3.0",
        "drupal/devel": "^4.1",
        "drupal/eck": "^1.0@alpha",
        "drupal/editor_advanced_link": "^1.4",
        "drupal/entity_type_clone": "^1.7",
        "drupal/entityqueue": "^1.1",
        "drupal/field_group": "^3.2",
        "drupal/gin": "^3.0@alpha",
        "drupal/gin_login": "^1.0",
        "drupal/gin_toolbar": "^1.0@beta",
        "drupal/honeypot": "^2.0",
        "drupal/httpswww": "^2.0",
        "drupal/login_destination": "2.x-dev",
        "drupal/login_history": "^1.0",
        "drupal/mailsystem": "^4.3",
        "drupal/metatag": "^1.5",
        "drupal/node_view_permissions": "^1.2",
        "drupal/override_node_options": "^2.4",
        "drupal/paragraphs": "^1.5",
        "drupal/pathauto": "^1.2",
        "drupal/rabbit_hole": "^1.0@beta",
        "drupal/recaptcha": "^3.0",
        "drupal/redirect": "^1.3",
        "drupal/redis": "^1.4",
        "drupal/restui": "^1.16",
        "drupal/smtp": "^1.0",
        "drupal/tablefield": "^2.0@alpha",
        "drupal/token": "^1.3",
        "drupal/user_current_paths": "^2.0",
        "drupal/user_restrictions": "^2.0",
        "drupal/video_embed_field": "^2.0",
        "drupal/views_data_export": "^1.0",
        "drupal/views_field_view": "^1.0@beta",
        "drupal/webform": "^6.0",
        "drupal/weight": "^3.3",
        "drush/drush": "^10.3",
        "symfony/var-dumper": "^5.1",
        "vlucas/phpdotenv": "^2.4",
        "webflo/drupal-finder": "^1.0.0",
        "webmozart/path-util": "^2.3"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true,
        "allow-plugins": {
            "composer/installers": true,
            "drupal/console-extend-plugin": true,
            "cweagans/composer-patches": true,
            "drupal/core-composer-scaffold": true,
            "drupal/core-project-message": true
        }
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ],
        "files": ["load.environment.php"]
    },
    "scripts": {
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "installer-paths": {
            "public_html/core": ["type:drupal-core"],
            "public_html/libraries/{$name}": ["type:drupal-library"],
            "public_html/modules/contrib/{$name}": ["type:drupal-module"],
            "public_html/profiles/contrib/{$name}": ["type:drupal-profile"],
            "public_html/themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/Commands/{$name}": ["type:drupal-drush"]
        },
        "patches": {
            "drupal/core":{
                "Entity reference Fix": "https://www.drupal.org/files/issues/2019-03-26/user_cant_reference_unpublished_content-2845144-24.patch"
            },
            "drupal/token":{
                "Path Alias Language Fix - Token Issue": "https://www.drupal.org/files/issues/2019-03-14/2945272-8-token-language.patch"
            },
            "drupal/rules":{
                "Drupal Rules Fix": "https://www.drupal.org/files/issues/2725525-14.fatal_error_call_to_role_id.patch"
            },
            "drupal/recaptcha":{
                "Drupal Captcha Fix": "https://www.drupal.org/files/issues/2019-11-15/3035883-29-workaround.patch"
            }

        },
        "drupal-scaffold": {
            "locations": {
                "web-root": "public_html/"
            },
            "file-mapping": {
                "[web-root]/sites/development.services.yml": false
            }
        }
    }
}

Thanks a lot.

4
  • This is another Composer question that doesn't provide the composer.json file which we could easily use to reproduce the problem.
    – cilefen
    Dec 5, 2022 at 13:41
  • Added the composer file, thanks for the tip
    – Joost
    Dec 5, 2022 at 14:38
  • php -d memory_limit=-1 $(which composer) install -n
    – leymannx
    Dec 5, 2022 at 16:51
  • 1
    This looks like a bug in the patch program: github.com/cweagans/composer-patches/issues/423
    – cilefen
    Dec 5, 2022 at 18:15

1 Answer 1

16

Thanks @cilefen for pointing me in the right direction. For me solution 423 of this thread fixed the problem: https://github.com/cweagans/composer-patches/issues/423#issuecomment-1301026697

The solution suggested in the comment by Mike Ohara is: 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 gpatch which installs patch GNU patch 2.7.6 After which, no issues with patches applying, including the one that failed for @dpi

1
  • This fixed my issue too. Thanks Joost! Feb 16 at 18:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.