What was the goal?
To check the status of the automatic updates initiative and find ways to contribute to it.
What steps did you take, starting when you added the Automatic Updates module to your Drupal project (see https://www.drupal.org/i/3275810#install-module for instructions)? Include anything that seems relevant, including commands you ran, links you clicked on, output logs, suitable config files, screenshots, screen recordings, etc.
I added the automatic_updates module to the existing site using the composer command:
composer require drupal/automatic_updates
And I installed the module from the UI as explained on the documentation page.
What was your environment like?
- Drupal core - 9.3.9 (used the cloned version of the core with the tag checked out..
- The site was served with lando. The configuration file -
name: d9 recipe: drupal9 services: appserver: overrides: environment: # Support debugging Drush with XDEBUG. PHP_IDE_CONFIG: "serverName=appserver" XDEBUG_SESSION_START: lando config: webroot: . database: mariadb via: nginx php: 7.3 drush: "*" composer_version: '2.3.5' xdebug: true
Did you accomplish your goal? Were the instructions clear? Did you observe any bugs or errors or other issues? Did you need to do any workarounds?
The instructions were pretty clear to follow.
I did run into some issues and I tried some workarounds for them -
- The temporary directory write issue in the container. It seems like the automatic_updates module tried to create a directory in the
/tmpdirectory in the container and it was not able to do that. As a workaround, I changed the temporary directory for the Drupal site in settings.php using
$settings['file_temp_path'] = 'sites/default/files/tmp'; - There was still some issue with the copy and I switched to use of
rsyncafter following the instructions at https://www.drupal.org/project/automatic_updates/issues/3275810#drush-rsync - I was able to get the updates started and ran into the permission issue again. Screenshot:
Problem with these instructions? Anything else we should know?
Screenshot of the status page:

| Comment | File | Size | Author |
|---|---|---|---|
| Screen Shot 2022-04-28 at 4.15.56 PM.png | 807.73 KB | ajits | |
| Screen Shot 2022-04-28 at 4.24.07 PM.png | 1.12 MB | ajits |
Comments
Comment #2
phenaproximaOooh, this is a good find.
I suspect we probably will need to add some kind of check in Package Manager to ensure that the temporary directory (or "staging root" in Package Manager's jargon) is writable, to prevent folks from running into this error without recourse.
However, what confuses about your fix is this: as far as I know, Package Manager never uses file_temp_path to create its staging area. It normally delegates to
FileSystem::getOsTemporaryDirectory(), which doesn't usefile_temp_path. So I don't know how it's possible that your change to settings.php worked around the problem. 🤔Comment #3
phenaproximaThis needs further triage, but I suspect we have a new stable blocker here.
I'm not going to change the issue status or tags right now, but based on my reading of @AjitS's top-notch bug report, I think that's what this boils down to: the staging root being inside the active directory is a no-go, and we're not doing enough to guard against that.
Comment #4
Theresa.GrannumComment #5
Theresa.GrannumWill need @tedbow to review 3rd point to continue with issue.
Comment #6
traviscarden commentedNo, Composer Stager does not ensure that the staging directory is not inside the active directory because it explicitly supports (and tests) that scenario. See RsyncFileSyncer.php#L73-L76 and PhpFileSyncer.php#L104-L109, c.f. EndToEndFunctionalTestCase.php#L276-L300.
Comment #7
tedbow@TravisCarden thanks for clearing that up.
re @phenaproxima's question as #2
it does ultimately use
file_temp_pathor at least we have test coverage for that case in \Drupal\Tests\package_manager\Kernel\StageTest::testGetStageDirectoryIt looks like
\Drupal\Core\File\FileSystemInterface::getTempDirectory()will use this. See docsalso see implementation
so it looks like it could be under docroot or anywhere
Comment #8
tedbowFrom #3
We are not on beta so this is done
this was fixed in #3278411: Always use FileSystemInterface::getTempDirectory() to get the temporary directory
re #6 it seems like composer stager supports this. Of course we don't to support this if we think it will lead to other problems
So we might want an issue to make this check.
Comment #9
tedbowcreate follow-ups
#3299093: Add validation that staging directory is writable
#3299094: Prevent staging areas that nested in the active Composer project directory
Credited @AjitS on both. Thanks for testing and finding this issues