You get Project xxx could not be downloaded to C:\inetpub\wwwroot\... folder when running 'drush pm-download' command on windows box. Detailed error can be accessed by running with --debug option, however it may be not very clear for users to do that and output of debug command is pretty messy. The actual error is Access denies trying to create new folder and elevated command prompt is most likely required to run drush.
Attached patch provides more meaningful message to windows users to remind them they should run elevated command prompt most likely and to log drush error without running --debug mode so it is more easier for users to troubleshoot.
Additionally drush_pm_lookup_extension_in_cache() and _drush_pm_get_extension_cache() functions are fixed to use correct temp folder by calling drush_find_temp(). I found later that similar implementation is done in #1049660: remove hardcoded drush pm extension cache but it is a little obsolete.

Comments

kulov’s picture

Title: Access denies error using pm-download on windows » Access denied error using pm-download on windows
kulov’s picture

kulov’s picture

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

Status: Needs review » Postponed (maintainer needs more info)
Issue tags: +Windows

The extension cache has been removed, so most of this patch is no longer necessary. Do we still need to remind the user about elevated privileges in the mkdir function? Seems that we should just put this in the Windows howto / readme; if a message is needed, then perhaps a more central location would be better? (Other commands besides mkdir may need elevated privileges.)

I think we can just close this out; re-open with a new patch if you want to deal with the message.

kulov’s picture

I think we should remind them of this possible scenario. It is a common mistake on Windows that has User Access Control enabled. It is also a common practice for programs to remind about that. It should be also included in other commands besides mkdir where it writes outside of its own folder. Its need has to be reviewed per every single location though. It is also important that drush_set_error is used in order to generate error that is seen without running verbose mode.
It is ok to move it to a separate issue, however I am not sure I am able to identify where it more central location should be or what are the other places that need this message.

Looking at it now there is one more thing that this patch does. It has improved and more readable implementation of _drush_recursive_copy. It has a closedir($dir_handle) to close the handle from opendir above it. I do not recall 100% what was the problem, but it lead me to fix it there.

ice5nake’s picture

I am running drush in an administrator command prompt but I am still getting Access is Denied messages.

So far I've tried to disable a module, run help, and run status

status and help just give mkdir warning though. While disable gave opendir error. Let me know if there is anything I can do to help.

kulov’s picture

Can you get the output of running the command with --debug option, please?

greg.1.anderson’s picture

Version: » 8.x-6.x-dev
Status: Postponed (maintainer needs more info) » Closed (won't fix)
Issue tags: +Needs migration

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

If this feature is still desired, you may copy it to our Github project. For best results, create a Pull Request that has been updated for the master branch. Post a link here to the PR, and please also change the status of this issue to closed (duplicate).

Please ask support questions on Drupal Answers.