Had a problem getting core updated with drush on windows (v5.7, using the Windows Installer, running on Windows Server 2008R2). CD'd to the project root, executed a "drush status" and things looked ok (7.14), executed "drush pm-update drupal" and received an error that "Destination directory drupal-7.15 already exists." This was followed by a message about the update being successful, followed by a message about the changes being rolled back. Another execution of "drush status" showed the same as the first - version is still 7.14. Checks on the site showed it was ok, and it was still version 7.14.

This was on a vm I had access to, and was able to restore the vm (checkpoint immediately prior to install of drush), and ran about 15 more attempts at trying to execute this with various changes to options in the install, and couldn't detect any changes.

Proposed resolution

After being unsuccesful above, I started adding echo()s in various places to track down what might be the problem. There's a function package_handler_download_project() in the file commands/pm/package_hander/, and towards the end of it there is a nested equivalence check for request['project_dir'] against project_dir - that seemed to be the problem. The project_dir variable is initialized with the first line of the output from the bsdtar.exe execution, however bsdtar.exe is outputting its extraction notifications in the form "x ". The equivalence check being performed was testing the value "drupal-7.15" against "x drupal-7.15" and failing, prompting the call to drush_move_dir() with the overwrite parameter defaulting to FALSE, and the test for file_exists() against the existing directory resulting in the call to drush_set_error in the first chunk of that function.

I'd propose checking for a leading "x " after setting the project_dir variable, and stripping that if it exists, towards the end of the package_handler_download_project() function:

  // Move untarred directory to project_dir, if distinct.
  if (($request['project_type'] == 'core') || (($request['project_type'] == 'profile') && (drush_get_option('variant', 'full') == 'full'))) {
    // Obtain the dodgy project_dir for drupal core.
    $project_dir = drush_trim_path($file_list[0]);

    // Detect and strip potential leading output from a tar operation...
    if(strpos($project_dir, "x ") === 0) {
      $project_dir = trim(substr($project_dir, 1));

    if ($request['project_dir'] != $project_dir) {

Remaining tasks

Not very familiar with submitting patches directly to projects at the moment - hoping someone can evaluate whether this is a valid problem problem to solve, and maybe the proposed solution above can help point towards a more final resolution to it. Will continue to check back and when I get some more time I can work to provide a more official patch (2+ weeks), unless I've overlooked the problem and there are more convenient workarounds/problems to solve.

#4 1.patch622 bytesdmitry_bezer
#2 1.patch571 bytesdmitry_bezer
Members fund testing for the Drupal project. Drupal Association Learn more


moshe weitzman’s picture

Assigned: Unassigned » dmitry_bezer
Issue tags: +Windows
dmitry_bezer’s picture

571 bytes

Thank you for the research!
The root of the problem is drush_tarball_extract() function which returns incorrect file listing on windows. It should cut off the 'x ' prefix. The proposed patch is attached.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

Please add a comment linking to this issue.

dmitry_bezer’s picture

622 bytes

Link added

moshe weitzman’s picture

Status: Reviewed & tested by the community » Fixed

Committed and backported.

jaminion’s picture

Hey guys, wanted to say that I've tested a few installs across Windows 7 and Windows 2008 Server with this patch and it is working great for me. Had a hangup with a module update that I had to research to make sure it wasn't associated with this patch, and will find or submit another report for that one.

Appreciate the quick review and work, you guys are fantastic!!

Status: Fixed » Closed (fixed)

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

zerouno62’s picture

I have the same problem when using drush pm-update. Can anybody tell me how I can install this patch? Thanks in advance, Raffaele

DanChadwick’s picture

To those on windows (zerouno62 others), the latest installer is 5.7, which doesn't have this patch. If you have git installed, you can:

  1. If you haven't already, install drush 5.7 using the windows installer. See for instructions.
  2. Clone the git directory at some convenient location (outside your web root). Follow the instruction on the drush project page ( You probably want branch 7.x-5.x-dev.
    cd path/where/you/want/drush-downloaded
    git clone --recursive --branch 7.x-5.x
    cd drush
  3. Copy (using filemanger if you want) all but the .git directory to where the windows installer put drush 5.7. By default, this is c:/ProgramData/Drush. You should probably first move the contents of this directory elsewhere as a backup.
  4. Test by cd to your drupal directory and checking the version with drush version. Don't be alarmed if the reported version is 7.0-dev.
  5. To get newer version, you can use git to fetch the latest and repeat the copy step above.

I found more detailed instructions, relating to upgrading drush for a different reason: