Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 957271f

Browse filesBrowse files
hintrongreglucas
andcommitted
Resolve configdir to handle potential issues with inaccessible symlinks
There are some use cases where a user might have a symlinked home directory (e.g. a corporate home directory may be symlinked to a disk with limited space, and is only accessible to other users via a real path to the underlying disk). Resolving configdir before any mkdir or access checks should avoid this problem. Co-authored-by: Greg Lucas <greg.m.lucas@gmail.com>
1 parent 42b88d0 commit 957271f
Copy full SHA for 957271f

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎lib/matplotlib/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/__init__.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,15 @@ def _get_xdg_cache_dir():
519519
def _get_config_or_cache_dir(xdg_base_getter):
520520
configdir = os.environ.get('MPLCONFIGDIR')
521521
if configdir:
522-
configdir = Path(configdir).resolve()
522+
configdir = Path(configdir)
523523
elif sys.platform.startswith(('linux', 'freebsd')):
524524
# Only call _xdg_base_getter here so that MPLCONFIGDIR is tried first,
525525
# as _xdg_base_getter can throw.
526526
configdir = Path(xdg_base_getter(), "matplotlib")
527527
else:
528528
configdir = Path.home() / ".matplotlib"
529+
# Resolve the path to handle potential issues with inaccessible symlinks.
530+
configdir = configdir.resolve()
529531
try:
530532
configdir.mkdir(parents=True, exist_ok=True)
531533
except OSError:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.