Skip to main content

Attempting to apply a patch in Drupal 10.2.4 that had been working until this version.  Now I'm seeing the following error

Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d '/Users/andrewfletcher/Sites/codebales/modules/contrib/facets' < '/Users/andrewfletcher/Sites/codebales/patches/3336646-function-is-deprecated.patch'" exceeded the timeout of 300 seconds.

 

This error indicates that the patching process exceeded the maximum execution time limit of 300 seconds. This timeout issue could be due to various reasons, such as system performance, the complexity of the patch, or how the patch command is handling files. 

1. Increase the Timeout Limit

If you're applying the patch through a script or a tool that allows you to configure execution time limits, consider increasing the timeout setting. However, since the timeout is happening at the command line level, this might not be directly applicable.

 

2. Apply the Patch Manually

Given the relatively straightforward nature of the patch, you could manually apply the changes. This involves opening the Result.php file in an editor and inserting the new properties transliterateDisplayValue and termWeight as indicated by the patch. This manual process ensures that the patch's intended changes are applied without depending on the patch command's performance.

Manual Patching Steps:

Open Result.php located in src/Result/.

Locate the last property declaration in the class. Based on your file content, it should be right after the $children property declaration.
Insert the new property declarations for transliterateDisplayValue and termWeight exactly as shown in the patch. Ensure that you maintain the correct PHP syntax and formatting.

Here's how the insertion would look based on the patch:

/**
* Children results.
*
* @var \Drupal\facets\Result\ResultInterface[]
*/
protected $children = [];
/**
* The facet transliterate display value.
*
* @var string
*/
public $transliterateDisplayValue;
/**
* The term weight.
*
* @var int
*/
public $termWeight;
/**
* Constructs a new result value object.
*
* ...
*/


3. Verify Patch Application

After manually applying the changes, ensure that your application behaves as expected. Testing is crucial to verify that the manual patch application hasn't introduced any syntax errors or other issues.

 

Review your composer.json file to check the patch

"patches": {
     "drupal/facets": {
          "deprecated function": "patches/3336646-function-is-deprecated.patch"
     }
},

 

Related articles