Problem/Motivation
install_profile_info() keeps a static cache, but that cache does not vary per the passed in langcode. Thus, if a call such as install_profile_info('standard', 'en), will pollute the return value of a later call to install_profile_info('standard', 'de).
This in fact happens in core with the call to _install_select_profile() (which in turn calls install_profile_info() from _install_begin_request(). No language code is passed at this point (so the default en is used), which pollutes a later call to install_profile_info() where the language code is passed.
This causes locale and language module to not be installed, which breaks (as in fatal error) the later call to entity_load('configurable_language', ...).
Strangely, I don't see any of the relevant code as having been changed since March 2014 but I'm almost 100% certain that drush si --locale=de worked in Amsterdam (September 2014), so I don't know what caused this.
Proposed resolution
Vary the static cache by the passed-in language code.
Remaining tasks
User interface changes
None.
API changes
None.
Beta phase evaluation
| Issue category | Bug because drush si is broken (as in it fatals) for anything other than English installations |
|---|---|
| Issue priority | Major because 80% of the internet is non-English speaking. (If this were did not affect "just" Drush it would be critical.) |
| Unfrozen changes | Not unfrozen |
| Prioritized changes | Prioritized because it is a bug |
| Disruption | No disruption (not even for installation profiles/distributions/...) |
| Comment | File | Size | Author |
|---|---|---|---|
| #39 | 2474537-39.patch | 2.1 KB | Noe_ |
| #30 | 2474537-30.patch | 1.73 KB | Noe_ |
| #24 | 2474537-24-install-profile-info.patch | 1.72 KB | Noe_ |
| #24 | 2474537-24-only-test.patch | 911 bytes | Noe_ |
| #20 | 2474537-20-only-test.patch | 911 bytes | Noe_ |
Comments
Comment #1
tstoecklerHere we go.
Comment #2
tstoecklerComment #3
Patrick Storey commentedI was not able to recreate this problem. Drush si worked for me with the --locale=de designation.
I used MAMP PRO 3.2.1, Drush 7.0-dev, and Drupal 8.0.0-beta9
I made a new directory and then from the terminal I:
I took that screenshot after I started to translate the site back to English as I can not currently read German. :-)
Comment #4
Patrick Storey commentedI'm adding the novice tag because this task has clear steps to completion and won't take long to complete.
Please see if the steps I wrote work for your machine.
Comment #5
michaellenahan commentedThe patch works for me.
On Ubuntu 14.04 I was able to recreate the problem with the latest drupal-8.0.x (b31bbb084ab0d5e5a9ce0985db1dccaf39242bf9)
https://www.drupal.org/files/issues/2474537-installation-fails.txt
After patching the installation succeeds.
https://www.drupal.org/files/issues/2474537-installation-succeeds.txt
Here's a screenshot.
https://www.drupal.org/files/issues/2474537-screenshot.png
Setting to RTBC.
Comment #6
alexpottThe fix looks good. I think we should be able to kernel test this just by calling the function with different language after including install.inc
Comment #7
Noe_ commentedAdded a test, to see if the code #1 actually works.
Comment #8
Noe_ commentedWhoops, forgot to remove the ini_set.
And I uploaded the working patch from tstoeckler.
They are separate so you can see that the test fails first, and then after applying the patch it works.
Comment #9
cilefen commentedComment #12
cilefen commented@Noe_ Nice work on this. We need the full patch please, with the test and the core code changes.
We need a function comment.
We usually do not use camel-case for local variables.
The assert comment should be something like 'Locale is not set in the dependencies key.' Also something more appropriate should be in the dutch line.
Comment #13
Noe_ commentedChanged the test according to #12
Comment #14
cilefen commented@Noe_ Great work! Could you please create the combined patch with the changes to install.inc and the test? It should be named 2474537-15.patch (if 15 is the next comment number). With it, post a patch with only the test. Name it 2474537-15-tests.patch. Before you post the comment, set the issue status to "Needs review" which signals the humans to check your work and the testbots to execute the automated tests.
Comment #15
Noe_ commentedAnd hereby the full patch, and a separate with only the tests.
Note that the full patch also contains the test.
Comment #17
Noe_ commentedThis is actually a brilliant example of the old codebase failing, and the patch passing.
Because the -only-test.patch is just the test, which fails.
And the install-profile-info.patch is the patch including the test, and this one passes.
So I setting it back to needs review.
Comment #19
cilefen commented@Noe_ Nice work. We are almost finished.
I would try "Tests profile info caching in non-English languages.", if it fits.
There should not be parenthesis in this statement.
The assert messages should end with periods. Also, the messages should match. "Locale is not set when installing in English." "Locale is set when installing in Dutch."
Once those are done, this will be RTBC for me.
Comment #20
Noe_ commentedThere you go.
Comment #23
cilefen commented@Noe_ It looks as though both patch files were the same - the test only. We need the combined patch.
Let's go with "Locale is not set when installing in English."
Comment #24
Noe_ commentedwhoops.
Comment #26
cilefen commented@Noe_ Great! Could you post the single, combined patch (no need for the test-only patch any more) with 1 and 3 from comment #19 fixed?
Comment #27
cilefen commentedThis could be a duplicate of #1338384: install_profile_info() returns inconsisent data.
Comment #28
cilefen commentedThe way the caching bug works, it matters whether you specify the install profile to drush.
drush -y si standard --locale=deworksdrush -y si --locale=dethrows an exceptionComment #29
Patrick Storey commentedRemoving the Novice tag as the task I assigned it to (testing this with the standard profile designation) has been completed by Cilefen in IRC for the latest patch in comment #24.
Comment #30
Noe_ commentedCilefen, I have made the next patch to include #1 and #3 from #12
Comment #34
cilefen commented@Noe_ When a something like this happens, it is usually because a recent commit has changed HEAD in a way that affects the issue. Looking at the recent core commits, I noticed #1081266: Avoid re-scanning module directory when a filename or a module is missing could be the commit that is affecting this.
Comment #36
Noe_ commentedcilefen: I think you are quite right.
Because someone added this line of code:
trigger_error(SafeMarkup::format('The following @type is missing from the file system: @name', array('@type' => $type, '@name' => $name)), E_USER_WARNING);And I get this message when I run the test:
"The following module is missing from the file system: standard"
After a bit of searching in bootstrap.inc I found this:
at line 223.
So it should be known since someone added a @todo, but I think this is why the test fails now.
Any thought about how to proceed?
Comment #38
cilefen commented@Noe_ You have to prime the filename cache now.
From ModuleHandlerTest::testModuleList():
We should use the testing profile for the assert if possible. I would use exactly the same comment in this test.
Comment #39
Noe_ commentedFixed the problems we were having because of #1081266
The solution was #38.
Comment #40
Noe_ commentedForgot to set the Status to "Needs review"
Comment #41
cilefen commented@Noe_ Nice work!
I have tested the patch manually. The test identifies the only difference when install_profile_info() is called and uses the same cache priming and comment used in other tests in core.
Comment #42
alexpottCommitted 99aa2d6 and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Comment #44
gábor hojtsyYay, thanks!
Comment #45
gábor hojtsyComment #47
oneliner commentedI can see this happening in the web install for Drupal 9.0.7
ubuntu 18.04 lts
php 7.3 fpm as fcgi
Apache 2.4.46
Selecting english lets installation continue, all other languages give redirect error
- other working drupal installs on server: yes(Drupal 8)
- obtained codebase via composer command
composer create-project drupal/recommended-project