Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Appdirs can return non writable directories #146

Closed
hmaarrfk opened this issue May 9, 2020 · 3 comments
Closed

Appdirs can return non writable directories #146

hmaarrfk opened this issue May 9, 2020 · 3 comments

Comments

@hmaarrfk
Copy link

hmaarrfk commented May 9, 2020

It seems like appdirs can return a directory that cannot be written to.

Is this an expected feature?

scikit-image/scikit-image#4664

From the original user:

For my flask app's service, the user is a no-login user, and somehow this resolves to /var/www/.
The user doesn't have permissions to create a directory there, so the flask app crashes with a PermissionError raised from.

@leducvin
Copy link

Leaving a few more details on scikit-image/scikit-image#4664... for my flask app running under user www-data, the home directory is /var/www. Here is the output of getent passwd www-data:

www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

When appdirs.user_cache_dir() gets called, it returns /var/www/.cache. This is read-only.

@zoofood
Copy link
Contributor

zoofood commented May 12, 2020

Thanks for sending along the information @hmaarrfk and @leducvin.

Appdirs doesn't do tests of the viability of a directory for writing content to it. It provides what the directory should be according to the XDG spec, effectively $HOME or set the XDG environment variable XDG_CACHE_HOME.

@zoofood zoofood closed this as completed May 20, 2020
@hmaarrfk
Copy link
Author

thanks for the confirmation that this is the intended behavior

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants