Skip to content

Loading…

Include username in tempdir #1213

Merged
merged 1 commit into from

2 participants

@mdboom
Matplotlib Developers member

Fixes an issue introduced by #832. If multiple users on the same machine have non-writable home directories, the /tmp/matplotlib directory created may be shared. This includes the user's login name in the directory name to prevent that.

Discovered by Matt Anderson.

@mdboom mdboom Put user's name in the temp directory that gets created when the home…
… directory is not writable. Fixes race conditions on a multi-user machine discovered by Matt Anderson.
0ee2e5d
@pelson
Matplotlib Developers member

I see no harm in this change. +1

@mdboom mdboom merged commit d563d62 into matplotlib:master

1 check failed

Details default The Travis build failed
@mdboom mdboom deleted the mdboom:tempdir-username branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 7, 2012
  1. @mdboom

    Put user's name in the temp directory that gets created when the home…

    mdboom committed
    … directory is not writable. Fixes race conditions on a multi-user machine discovered by Matt Anderson.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/matplotlib/__init__.py
View
4 lib/matplotlib/__init__.py
@@ -471,9 +471,11 @@ def _create_tmp_config_dir():
If the config directory can not be created, create a temporary
directory.
"""
+ import getpass
import tempfile
- tempdir = os.path.join(tempfile.gettempdir(), 'matplotlib')
+ tempdir = os.path.join(
+ tempfile.gettempdir(), 'matplotlib-%s' % getpass.getuser())
os.environ['MPLCONFIGDIR'] = tempdir
return tempdir
Something went wrong with that request. Please try again.