Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When the Updater::findInfoFile() method parses, it's checking against '.info' files with 5 characters instead of '.info.yml' which is 9.
When installing Devel, it can't find a match and it picks the last one and displays "Devel Kint" as the project name on install through the UI on /admin/modules/install
Proposed resolution
Change the length it searches for.
Remaining tasks
User interface changes
API changes
Beta phase evaluation
Issue category | Task |
---|---|
Issue priority | Follow-up of a major issue |
Unfrozen changes | Unfrozen because it only changes tests |
Prioritized changes | Not prioritized. |
Disruption | Non-disruptive because it includes only test additions |
Comment | File | Size | Author |
---|---|---|---|
#41 | updater_findinfofile-2409515-41.patch | 2.53 KB | joelpittet |
| |||
#41 | interdiff.txt | 1001 bytes | joelpittet |
#37 | interdiff.txt | 743 bytes | joelpittet |
#37 | updater_findinfofile-2409515-37.patch | 2.53 KB | joelpittet |
| |||
#33 | updater_findinfofile-2409515-33.patch | 2.56 KB | joelpittet |
Comments
Comment #1
joelpittetComment #2
lakshminp CreditAttribution: lakshminp commentedComment #3
webchickSince this is a bug fix, seems like we need automated tests for this.
Comment #4
Palashvijay4O CreditAttribution: Palashvijay4O commentedTrying ......
Comment #5
Palashvijay4O CreditAttribution: Palashvijay4O commentedTagging the issue and unassigning the issue.
Comment #6
mark.labrecqueComment #7
joshi.rohit100Where are the tests located for this ?
Comment #8
joelpittetI think @mark.labrecque has some, I'll get them from him tomorrow and try to nail this one down.
Comment #9
joelpittet@joshi.rohit100 unless you want to tackle this? Please take it from me:)
Comment #10
joelpittetMy ability to write tests is poor but this should do the trick. I'm trying to write a unit test but ran into two problems and I'm sure there is someone out there that knows a more elegant solution.
Problem 1. Had to include file.inc in the method because Updater breaks encapsulation by using file_scan_directory() in it's method.
Problem 2. I had to add InfoParser to a new container because the container and the service is NULL. This one is the one I think would be easier to solve as I bet there is a way to get that in setUp or something better.
Comment #12
joelpittetIs there a better place and method of doing this?
Don't like this, breaks encapsulation. Ideas?
Whoops, easy fix;)
Comment #13
benjy CreditAttribution: benjy commentedYou can just do the following: Also, maybe move it to containerBuild().
$this->container->set(...)
I guess you could do $this->kernel->loadLegacyIncludes() but that only does the same thing, and includes a heap of extra files.
Comment #14
benjy CreditAttribution: benjy commentedAs discussed in IRC, my last comment was wrong, I thought we were talking about Drupal\system\Tests\Extension\ModuleHandlerTest and not Drupal\Tests\Core\Extension\ModuleHandlerTest
I think your current approach is correct when extending UnitTestBase.
Comment #15
joelpittetOk fixing the EOF newline, and moving a line under the comment it belongs. I think this is probably the best MVC we can do from @benjy's comment.
Comment #16
joelpittetTo test this you may need this #2042447-58: Install a module user interface does not install modules (or themes)
Comment #17
Manuel Garcia CreditAttribution: Manuel Garcia commentedComment #18
lauriiiTested this and seems to fix the problem described in the issue summary. Steps to reproduce this:
-on /admin/modules/install set "Install from URL" to http://ftp.drupal.org/files/projects/devel-8.x-1.x-dev.tar.gz
-Submit and you should see error message "Devel Kint is already installed.". After this patch it should be "Devel is already installed."
Comment #22
joelpittetDang, don't know what changed in head:(
Now needs 'file_system' service on the container... this test seems to be balooning out of control for a 1 character fix...
@webchick save me from this.
Comment #23
webchickFair enough. Since this issue indirectly holds up a critical issue (#2352637: Remove the UI for installing/updating modules from update module if it is not fixed in time for release), and since the actual problem here amounts to something we won't break again unless we decide to rename .info.yml to .info.yaml or something (which wouldn't happen until D9), I think it is OK to just commit the fix for now, and continue working on tests.
Committed and pushed #1 to 8.0.x. Thanks!
I was going to spin off a sub-issue for the tests, but I don't want the people who've already done work here to accidentally lose credit. So just changing the issue title/tags to represent what's left.
Comment #24
webchickComment #27
joelpittetI think this needs a kernel test or something to avoid that type of include in the test.
Comment #28
joelpittetComment #29
lauriiiJust a nit..
Comment #30
lauriiifixing joels oopsie
Comment #32
joelpittetPoorly named class because it's not a unit test.
Only additions to this file.
Comment #33
joelpittetI'll be nicer here. The rename is moved here #2490388: InfoParserUnitTest web test classes mislabeled as unit tests which has a meta for that cause.
Comment #34
dawehnerI guess we should move this then maybe to system/src/Tests/Updater/UpdaterKernelTest?
Comment #35
joelpittet@dawehner the move is over here #2490388: InfoParserUnitTest web test classes mislabeled as unit tests so this patch is easy to read.
Comment #36
lauriiiOverall is good and patch still applies
This should be only on one line
Comment #37
joelpittetThanks for the review @lauriii
Comment #38
lauriiiComment #39
lauriiiOops didn't mean to RTBC yet
Comment #40
lauriiiOk talked this quickly with Joel on IRC and the bug fix is already in the HEAD because webchick reverted it twice. So this is only about adding test coverage to it. Patch looks good anyway.
Comment #41
joelpittetIt's now taking the first project not the last as it did before. Minor comment fix in test.
Comment #42
lauriiiStill rtbc!
Comment #43
alexpottMore tests++
Committed 9a7b71a and pushed to 8.0.x. Thanks!