Problem/Motivation

Environment:
A new install of the latest Drupal 7.x using the standard install profile.
A debian vagrant box: Linux default-d7 3.2.0-4-amd64 #1 SMP Debian 3.2.51-1 x86_64 GNU/Linux
PHP 5.4.4-14+deb7u7

When I visit the Account Settings page, /admin/config/people/accounts, the "Enable user pictures." checkbox is checked and the "Picture directory" field defaults to "pictures". If I save this form, and then resubmit it, I get this error:

The directory public://pictures does not exist or is not writable.
The settings have not been saved because of the errors.

This error prevents submitting the form. The public directory is sites/default/files and this directory and the sites/default/files/pictures directory have the 775 permissions.

I didn't find previous reports of this in the Drupal issue queue. This has been reported many times in the forum and elsewhere:

Many of have poor suggestions of hacking core to remove the error or using insecure 777 file permissions.

Debugging & work-arounds

I starting debugging from the error message in user_admin_settings(), which led me to file_prepare_directory(). And from there found existing issues that cause these issues:
#2102905: Passing a uri to is_writable
#1762068: file_prepare_directory() doesn't do what it should when fed a drupal URI
#1333390: file_prepare_directory() / is_writable() on Linux don't support ACLs
which eventually led me to the oldest known issue with the most work done for this problem:
#944582: Check for execute permissions on directories that require file write permissions
But that work is proceeding for 8.x branch. But referred me to this issue for 7.x which fixed the issue for me: #1899126: [D7] Add wrappers to fix permission checks

Another work-around to get the form to submit would be to use drush commands to directly set the variables. Such as:
drush vset user_picture_path your_path
Or to disable user pictures:
drush vset user_pictures 0

Remaining tasks

I've reported this closed issue to help others recognize the root of the problem and support the fix in this ticket for 8.x #944582: Check for execute permissions on directories that require file write permissions
This issue has a similar patch for 7.x that solved the problem for me in 7.38: #1899126: [D7] Add wrappers to fix permission checks

Comments

dooug’s picture

Issue summary: View changes

added work-around notes.

dooug’s picture

Issue summary: View changes
dooug’s picture

Issue summary: View changes
dooug’s picture

Issue summary: View changes
dooug’s picture

Issue summary: View changes
dooug’s picture

Issue summary: View changes
dooug’s picture

sidenote, while debugging, I found an inefficiency in user.admin.inc and posted the fix #2509214: Remove redundant calls: variable_get('user_pictures', 0) in user.admin.inc