Web design, programming, graphics, and pretty much anything else I care about.

Errors running update with drush, backup directory

I kept running into errors when doing updates with drush on my web servers.

WD php: rename(): The first argument to copy() function cannot be a directory in [error]
/[path to drush]/includes/drush.inc on line 581.
WD php:                                                                                                         [error]
rename(/[path to drupal]/sites/all/modules/admin_menu,/[path to drush]/backup/modules/20100519114134/admin_menu):
Success in /[path to drush]/includes/drush.inc on line 581.
Failed to backup project directory /[path to drupal]/sites/all/modules/admin_menu to                [error]
/[path to drupal]/backup/modules/20100519114134/admin_menu
rename(): The first argument to copy() function cannot be a directory in                                        [warning]
/[path to drush]/drush/includes/drush.inc on line 581.
rename(/[path to drupal]/sites/all/modules/admin_menu,/[path to drupal]/backup/modules/20100519114134/admin_menu):[warning]
Success in /[path to drush]/drush/includes/drush.inc on line 581.
An error occurred at function : drush_pm_updatecode                                                             [error]
WD php: array_merge(): Argument #2 is not an array in /[path to drush]/commands/pm/updatecode.pm.inc  [error]
on line 210.
array_merge(): Argument #2 is not an array in /[path to drush]/commands/pm/updatecode.pm.inc on line  [warning]
210.
An error occurred at function : drush_pm_update

I posted an issue about it. http://drupal.org/node/803386

As greg.1.anderson correctly pointed out, it is a php limitation. The problem is with the rename() function. It is not capable of moving files from one volume to another, and my modules directory is on a mounted file system. It does not matter if it is symbolically linked.

To fix it, I just specify the backup directory (--backup-dir). In the newer versions of drush, they changed this to default to the users home directory. It used to automatically go into a directory called "backup" in the modules directory.