pm-download goes through some pains to insure that it can mv or rename or rsync the file, but backing up a project directory does not.

    if (!drush_op('rename', $project['full_project_path'], $backup_target)) {
      return drush_set_error('DRUSH_PM_BACKUP_FAILED', dt('Failed to backup project directory !project to !backup_target', array('!project' => $project['full_project_path'], '!backup_target' => $backup_target)));
    }
CommentFileSizeAuthor
#11 drush-965878.patch868 bytesjonhattan
#1 drush-965878.patch1.02 KBjonhattan

Comments

jonhattan’s picture

StatusFileSize
new1.02 KB

That is the backup version control engine. It is used by pm-updatecode but not by pm-download. Anyway it seems it is enough to switch to drush_move_dir(). untested.

jonhattan’s picture

Status: Active » Needs review
greg.1.anderson’s picture

Status: Needs review » Reviewed & tested by the community

Yes, that's simple enough all right, and works perfectly.

jonhattan’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Comitted.

jonhattan’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

rolfmeijer’s picture

Status: Closed (fixed) » Needs work

When upgrading Drupal Core, the directory could not be moved. Moving the backup directory to the same volume resolved my issues. (See #1094366: update drupal core fails because the temporary files can’t be moved.)

I guess re-opening is appropriate?

monotaga’s picture

I'm confused on this one. I'm getting the same error that rolfmeijer is over in #1094366: update drupal core fails because the temporary files can’t be moved:

Executing: mkdir '/path/to/home-dir/drush-backups/science_drupal/20110531202301'
Calling is_readable(/var/www/html/drupal/dev/drupal-7.2)
Calling is_writable(/path/to/home-dir/drush-backups/science_drupal/20110531202301)
Calling rename(/var/www/html/drupal/dev/drupal-7.2, /path/to/home-dir/drush-backups/science_drupal/20110531202301/drupal)
Drush command terminated abnormally due to an unrecoverable error.                                                                                             [error]
Error: require_once(): Failed opening required '/var/www/html/drupal/dev/includes/errors.inc' (include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/html/drupal/dev/includes/bootstrap.inc, line 2094 [28.99 sec, 33.28 MB]

Running "drush up" with "--backup-dir=/this/dir" was a workaround, but isn't this still an issue that needs fixed?

My server situation is RHEL 6 with Drush 4.4 AND automounted user folders (which is why I'm guessing I'm getting this error [ie. #1094366: update drupal core fails because the temporary files can’t be moved]).

rolfmeijer, you reopened this. Are you using drush 5.x-dev or 4.4?

rolfmeijer’s picture

I’m using 5.x-dev

jonhattan’s picture

Status: Needs work » Needs review

From drush_move_dir():

  // Try rename. It will fail if $src and $dest are not in the same partition.
  if (@drush_op('rename', $src, $dest)) {
    return TRUE;
  }

Perhaps changing this nasty @ to a try/catch may help. Patch attached. Untested.

ps. there's no try/catch/else construct for php? of course python has ;) http://docs.python.org/whatsnew/2.5.html#pep-341

jonhattan’s picture

StatusFileSize
new868 bytes

The patch

brunorios1’s picture

+1

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. If you tested the failure scenario and it works as expected, then this is RTBC. Thanks jonhattan.

jonhattan’s picture

Status: Reviewed & tested by the community » Closed (duplicate)

I was able to reproduce this error and found a proper solution. See #1204862: drush up can't update D7 because of drupal error handler intervention..

marking this one as duplicated of the other.