Problem/Motivation

In our production setup, we point a "current_www"-symlink to the DRUPAL_ROOT folder. When doing an archive-backup, the "docroot" written to MANIFEST.ini will be the symlink, instead of the actual target (a directory with a timestamp name) of the symlink.
Trying to restore the archive in a different environment (local dev) with a different destination-parameter, we get this error:

Source directory /tmp/drush_tmp_somenumbers/current_www is not readable or does not exist.

This happens because drush always resolves the 'current_www' symlink to DRUPAL_ROOT for naming the Drupal directory contained by the archive, but when restoring, it infers the Drupal directory from the manifest.

Proposed resolution

The easiest solution here should be to wrap the docroot written to the manifest in a realpath() call, so the symlink gets resolved. This solves the problem in our case, but shouldn't introduce any incompatibilities either.

Remaining tasks

Another idea: instead of resolving the docroot, one might add the directory's name as an additional key to MANIFEST.ini and then use it for selecting the directory to copy from. This way, the original docroot could be used when extracting without setting --destination.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patrick_durold’s picture

This small patch (tested with 5.7 and master) simply resolves the symlink in the manifest.

patrick_durold’s picture

A different patch (tested with 5.7 and master) for this issue that solves it the other way round by renaming the directory during the tar process to its original symlinked name. Slightly more complicated.
Do not use this in conjunction with #1760642-1: Cannot archive-restore an archive-backup that was made from a symlinked DRUPAL_ROOT, only either one of these!

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Active » Closed (won't fix)
Issue tags: +Needs migration

This issue was marked closed (won't fix) because Drush has moved to Github.

If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.

james.williams’s picture

Issue summary: View changes

For anyone else that finds this, the bug was never resolved within drush 8.x-6.x, but is no longer applicable to drush 7.0, because the drupal root gets resolved with realpath() during bootstrap.