Problem/Motivation

The updates were not working for me.

It would create a directory in my project root and then copy the files there instead of overwriting my core files.

I figure out what happening is that \Drupal\automatic_updates\Services\InPlaceUpdate::getTempDirectory()
was returning /tmp/ but the "real" path was actually /private/tmp/ I am using a Mac and I think this is default behavior.

The extracting of the archive worked correctly but in \Drupal\automatic_updates\Services\InPlaceUpdate::processUpdate)_

there is

$file_real_path = $this->getFileRealPath($file);
$file_path = substr($file_real_path, strlen($this->getTempDirectory() . self::ARCHIVE_DIRECTORY));
$project_real_path = $this->getProjectRealPath($file_path, $project_root);

Since in the 2nd line we have $file_real_path, which is the "real" path and has "/private/", but $this->getTempDirectory() does not have /private/ then $file_path would be incorrect and also $project_real_path

Proposed resolution

In \Drupal\automatic_updates\Services\InPlaceUpdate::getTempDirectory() use \SplFileInfo::getRealPath() to return the "real path".

Remaining tasks

Patch

CommentFileSizeAuthor
#2 3156467-2.patch845 bytestedbow
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tedbow created an issue. See original summary.

tedbow’s picture

Here is the fix

With this automatic updates work for me from 8.9.0 to 8.9.1

tedbow’s picture

Title: Updates file is OS temp directory is a symlink » Updates fail if OS temp directory is a symlink
tedbow’s picture

Status: Active » Needs review
Wim Leers’s picture

Issue tags: +core-post-mvp

I think this is an obscure enough edge case that we can consider this out of scope for MVP. Do you agree, @tedbow?

Wim Leers’s picture

Assigned: Unassigned » tedbow
Status: Needs review » Reviewed & tested by the community
Issue tags: -core-post-mvp
Related issues: +#3328234: Improve test DX *and* confidence: stop using VFS

InPlaceUpdate no longer exists, so the patch no longer applies.

And actually … we ran into this too over at #3328234: Improve test DX *and* confidence: stop using VFS.

AFAICT if we can get #3328234 to work, then that proves that Automatic Updates now is correctly handling this, and that it actually was fixed a long time ago (which makes sense, given that most development of this module happens on macOS and #2 dates back ~2.5 years).

I think that would mean that we can mark this Closed (outdated).

But this requires somebody who knows the history of this project, so … RTBC'ing and assigning to @tedbow so he can hopefully close this out 🤞

Wim Leers’s picture

Wim Leers’s picture

Title: Updates fail if OS temp directory is a symlink » [upstream] Updates fail if OS temp directory is a symlink
Assigned: tedbow » Unassigned
Status: Reviewed & tested by the community » Postponed
Issue tags: +Needs upstream bugfix

See #3319507-44: Add symlink support to Composer Stager 2.0, require that version, and simplify UX & tests accordingly — this is blocked on an upstream feature/bugfix in php-tuf/composer-stager.