Using the latest 5-dev snapshot drush dies when it can't create the lib directory. To avoid this problem, the lib directory should be added to the git repo.

Comments

kotnik’s picture

Status: Active » Needs review
StatusFileSize
new958 bytes

Adding just lib directory wouldn't make much change, you'd be unable to write to it anyway.

Better solution is to inform user about the permissions problem, not to leave her in terminal with this generic error. Patch attached.

greg.1.anderson’s picture

Status: Needs review » Needs work

This is an improvement, but it would be even better to preflight the command with a call to is_writable, so that the error message only refers to permissions when that is in fact the source of the error.

kotnik’s picture

It can not be any other issue, but permissions - hence that message. If you still insist, maybe to change error message to 'Unable to create directory !dir', without the permissions notice?

greg.1.anderson’s picture

mkdir can also fail if one of the parent folders is missing. #2 is best, and not much harder than #3.

kotnik’s picture

Yes, but this function recursively creates parent directories if needed. It acts like 'mkdir -p'. Only reason it might fail is that it does not have write permissions.

greg.1.anderson’s picture

Is mkdir guaranteed by specification to only fail per #5? Out of disk space / inodes may be rare, but that does not change the fact that #1 is wrong, #3 is nominally okay, and #2 is best.

kotnik’s picture

Status: Needs work » Needs review
StatusFileSize
new2.48 KB

Ok, in unlikely event we run out of inodes, user will be informed that something other than permissions has happened.

Also, I expanded drush_mkdir(), since one-liner was very unreadable.

kotnik’s picture

StatusFileSize
new1.45 KB

Re-roll with coding standard fix and squashing multiple commits into one.

PvO’s picture

As my upgrade stopped on line 249 of filesystem.inc (and with a memory_limit error) I tried this patch. There is no memory limit error anymore but still the upgrade does not continue. After I answer the firs question below with 'y' I get:

Would you like to continue anyway? (y/n): y
The directory  does not exist.
Would you like to create it? (y/n): y

D:\xampp\htdocs>

The second question is answered by the upgrade process, not by me.

Now I am really stuck. Do not know what to try else.

Thanks for helping me out!

Edit: Now could it be the directory can not be created because the whole path contains spaces? That was my problem with navigating with cygwin to apply the patch.
If anyone could tell me what directory to make I will make it by hand and then will try again.
Edit2: well, I think I see there is a function in filesystem.inc which should handle the space problem. Sorry.

PvO’s picture

Well....
I changed the root directory int "aliases.drushrc.php" to "D:\xampp\htdocs\waspik" and now the upgrade continued.
So recap: it was all a wrong root directory.

But ...
the upgrade was still not succesfull. I will start a new support request for new questions,

greg.1.anderson’s picture

Status: Needs review » Fixed

Committed. Thanks.

skwashd’s picture

Status: Fixed » Needs work

This patch solves 1 half of the problem. The original problem is that the path doesn't exist out of the box. I always install drush in /opt/drush as root and symlink the drush command to /usr/local/bin this is all done as root. All invocations of drush are by an unprivileged user who can't create the lib directory. I install Console_Table via PEAR so there is no need for drush to write to lib/ but drush insists on creating the directory at run time.

Creating the directory in the git repo solves the issue of the path not existing.

kotnik’s picture

greg.1.anderson’s picture

Title: mkdir(): Permission denied filesystem.inc:249 » Create 'lib' directory in git to avoid "mkdir(): Permission denied filesystem.inc:249" error

Agree with #12.

greg.1.anderson’s picture

Status: Needs work » Patch (to be ported)

Added lib and lib/README.txt to git, and fixed up .gitignore. Maybe my change to .gitignore was spurrious, as I needed to use -f to add the README anyway.

Re-open if there are any issues with this; if it's okay, the same thing could be done to the drush-4.x branch.

ice5nake’s picture

I just installed drush to a new server using the pear channel. I get this error. How do I modify the permissions to make this work?

kotnik’s picture

ice5nake, this is fixed in the latest HEAD.

Just start drush once as root, and you'll be good afterwards.

msonnabaum’s picture

Status: Patch (to be ported) » Fixed

Backported the error reporting fix, but we dont use lib in drush4 so i left that one.

Status: Fixed » Closed (fixed)

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