-
-
Notifications
You must be signed in to change notification settings - Fork 242
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 times out at first level when using multiple patch levels without -vvv flag #579
Comments
Actually I have tried version 2 and I had some issues with applying some patches. Namely
Running 1.7 seems to work only if using -vvv flag and multiple attempts, otherwise it will time out. I do not understand the logic of having a separate patches.lock.json if there is no separate patches.json How else can we modify values like depth per patch without updating the .lock file? |
https://docs.cweagans.net/composer-patches/usage/defining-patches/ See the "expanded definition" heading. You can specify depth on a per package or per patch basis.
You can use a separate patches.json file if you want. It works OOTB. (Same docs link as above) The lock file is the combination of all patches in the project - wherever they are defined. You should not be editing the lock file by hand. Anything that would require you to do that is either a) user error or b) a bug. |
ok atm my patches look like so:
Now if I want to use the expanded format that is used in 2.x format is like
so specifically I just want to enforce a level 2 patch for say
How can I do that?
|
The main issue here is that 1.7.x fails to apply level patches other than the first level unless using -vvv patch. If this worked as expected there would be no need to specify the patchLevel in composer.json |
would let you set it for that specific patch. However, patch depth of 2 is already the default for
1.x is effectively unsupported at this point. |
Opened #582 to capture the annoying compact -> expanded format conversion. |
@cweagans If 1.x is closed am I correct in assuming this issue is also in 2.x branch? i.e. patch levels are not applied unless using -vvv flag Also with regards the patch level for Drupal core, I believe the default is 2 for drupal/core and 1 for Drupal contributed modules. https://www.previousnext.com.au/blog/patch-drupal-core-without-things-ending-up-corecore-or-coreb |
No, 2.x works completely differently. Give it a go. Depth of 1 is the base default in 2.x as well (since that's the default for git apply). |
I tried it once and decided to roll back. It still looks like 2.x is in beta stage, so i find it puzzling you are no longer supporting 1.x I think we need something like this that retries 3 times before failing |
Ok I have tried to enable composer patches so that I can step though the code but am not quite sure what I am doing Currently getting:
when applying ? Any way, looking at the code we have this:
So in my case it looks like it first looks to apply a patch with git. If this is unsuccessful it iterates through each patch level and then tries to apply the patch. It looks to me as if the following message is actually coming from patch command e.g.
so specifically:
If -vvv command is not entered then the prompt is not visible and it times out. |
|
Ok I think we can use force here: -f or --force https://www.man7.org/linux/man-pages/man1/patch.1.html
|
cweagan-patch-timeout-fix.patch
I've tested this locally and it seems to work. Correct patch is applied without time out or having to use -vvv flag with multiple failed attempts. No need to specify patch level if either level, 1, 0, 2 or 4 - in that order |
How can I apply this patch? Can I apply with cweagans/composer-patches ? |
After manually applying patch, here is the output with patch applied: Downloading https://www.drupal.org/files/issues/2024-06-04/views_3450377_updated2_test.patch
patch '-p1' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
Executing command (CWD): patch '-p1' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'core/modules/views/config/schema/views.data_types.schema.yml.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es': No such file or directory
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'core/modules/views/src/Plugin/views/style/DefaultStyle.php.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es': No such file or directory
No file to patch. Skipping...
6 out of 6 hunks ignored--saving rejects to 'core/modules/views/src/Plugin/views/style/StylePluginBase.php.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es': No such file or directory
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'core/modules/views/templates/views-view.html.twig.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es': No such file or directory
No file to patch. Skipping...
2 out of 2 hunks ignored--saving rejects to 'core/modules/views/views.theme.inc.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrp5oe4aH3es': No such file or directory
patch '-p0' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
Executing command (CWD): patch '-p0' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'a/core/modules/views/config/schema/views.data_types.schema.yml.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa': No such file or directory
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'a/core/modules/views/src/Plugin/views/style/DefaultStyle.php.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa': No such file or directory
No file to patch. Skipping...
6 out of 6 hunks ignored--saving rejects to 'a/core/modules/views/src/Plugin/views/style/StylePluginBase.php.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa': No such file or directory
No file to patch. Skipping...
1 out of 1 hunks ignored--saving rejects to 'a/core/modules/views/templates/views-view.html.twig.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa': No such file or directory
No file to patch. Skipping...
2 out of 2 hunks ignored--saving rejects to 'a/core/modules/views/views.theme.inc.rej'
Can't create '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa', output is in '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/patchrBDfg3EK1Wa': No such file or directory
patch '-p2' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
Executing command (CWD): patch '-p2' -f --no-backup-if-mismatch -d '/Users/danlobo/Sites/streathamlifed8/web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/66793aa23a68d.patch'
patching file 'modules/views/config/schema/views.data_types.schema.yml'
patching file 'modules/views/src/Plugin/views/style/DefaultStyle.php'
patching file 'modules/views/src/Plugin/views/style/StylePluginBase.php'
patching file 'modules/views/templates/views-view.html.twig'
patching file 'modules/views/views.theme.inc'
|
Verification
composer self-update
)composer update cweagans/composer-patches
)What were you trying to do (and why)?
I am trying to apply a patches with both patch level 2 and 1 for drupal/core
If you specify
"patchLevel": {
"drupal/core": "-p2"
},
What happened? What did you expect to happen?
After running composer update:
Could not apply patch! Skipping. The error was: The process "patch '-p1' --no-backup-if-mismatch -d 'web/core' < '/var/folders/pn/ngzsxydj2ng4d1yjdflg6tx40000gn/T/666097568bf92.patch'" exceeded the timeout of 300 seconds.
If I apply same with -vvv flag It will manually prompt me for a path. After trying and failing, it will try the next patch level on the list:
"-p1 -p0 -p2 -p4"
Now drupal/core is set to -p2 for some reason. So it looks as if this is simply timing out.
However, can we have composer patches to try the next element on the list without having to specify the -vv flag and fail the manual path 3 times?
I have tried the same with composer patches beta 2 and I do not appear to have the same issue. i.e. composer patches applies the both patch level one and two without timeout.
Seems like a big improvement here.
Contents of
composer.json
Contents of
patches.lock.json
Full output of
composer patches-doctor
Full output of relevant Composer command with the
-vvv
flag addedThe text was updated successfully, but these errors were encountered: