-
-
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
Use dry-run to test patch in order to avoid empty folders being generated #178
Comments
I am having this same problem. Doing a "composer install" to update to the latest Lightning that uses the 1.6.4 version of composer-patches causes the creation of the "core/b" and "core/core" folders. Not sure what to try, but going to try going back to 1.6.3. |
Can this issue title be updated? The two extra sets of folders that are generated are not empty, they contain the patched files. Anyway this is affecting me too. I guess it's not really a problem that the files exist in multiple places since the autoloader would only load the ones in the correct path, but this a weird/ugly problem! |
As noted in #43, here's why this is happening:
Figured I'd post that in here so we know the issue behind it. |
To prove @johnzzon point, I used patch 229 from issue 2862041: (Note that this patch adds files. This issue isn't reproducible with a patch that doesn't add files) To test, I added the following to the extra section of the composer.json file of a new project created with drupal-composer/drupal-project:
This resulted with a Then I replaced all instances of "a/core/" with "a/" and "b/core/ with "b/" in the patch (attached) and ran `composer update drupal/core. The /web/core/b directory was not present after updating. |
So one workaround is to store the patch locally in your repo and strip out the /core/ from the paths. |
@bkosborne exactly my thought. On second thought, we can't commit to maintaining that. We should work to solve the problem here instead. |
I found this issue after creating independent patches for it, but my findings are largely similar to what people already found. The issue affects both The following
What happens instead is that, upon
The I concur with @johnzzon that the title should be updated - this would have helped me in finding the issue before going and fixing it in a slightly different way than the one already posted here. |
There are many other issues about this. 2.0.0 will solve it by allowing you to define the patch depth on a per-patch basis - no more guessing + incorrect results. |
I see. The option to define patch level in 2.x is definitely welcome. Still, without a stable 2.x release yet, this patch would have allowed to prevent having duplicate files in wrong places, a bug that I considered bad enough to warrant inclusion in a stable 1.x release. |
Sorry. I'm not spending more time on 1.x. It's too fragile to change major things at this point - a problem that I'm focusing on rectifying in 2.0.0. Which patch are you talking about? The one referenced in the OP was closed by the author because it didn't work. |
|
Also, patch depth is no longer guessed: either use the defaults or explicitly say what you want. :) |
Currently, I am trying to upgrade Drupal from 8.3.7 to 8.4.3 including BLT, Lightning, and Drush upgrade. I have found there are some bizarre files have been generated on the air after each build.
As you can see the core dir appears in 3 places as below:
This does not smell right and after investigation, I have found that those unwanted files are generated after patches defined in lightning has applied to
drupal/core
. I have checked this issue on our dev, test, and prod environments on Acquia Cloud and have found that this problem also happens on those servers. So this issue happens prior to my upgrade, I just happen to notice that during the upgrade work.Here are the details of my local environment:
Here is the log with my debug messages:
Here are my observations
As you can see in a lightning project when patches apply to
drupal/core
, onlyp2
works. This is because the original patches are created indrupal/drupal
in the root directory. But those patches target todrupal/core
in the Lightning composer.json. As a result, the install_path becomesroot directory/core
instead ofroot directory
.This is totally fine to apply the patch with the parameter
-p2
. However wrong files and directories are created even when patch attempts withp1
andp0
fail.The proposal
We can fix this by adding a dry run test before applying that patch.
-Here is the PR #179-
The patch is originally created when I was using Patch version 2.5.8 on Mac OS. However, after I installed GNU Patch version 2.7.1, this PR does not work anymore. Even using dry-run, empty folders will be still created.
Further questions
The PR should fix the wrong files issue. However, I am still wondering why these files are created by patch command. I have randomly picked some patches and try to produce this issue by manually applying some of those patches. But there is no avail. Maybe something related to composer? Here are the details of wrong files created.
-But I think this PR should be enough to avoid the issue.-
The text was updated successfully, but these errors were encountered: