Features
- Accept a keyword-only
ensure_existsin the module-level media directory functions, such asuser_documents_path, to create a directory set throughXDG_*_DIRoruser-dirs.dirs(#656) by @darrenhuai and @gaborbernat.
Bug fixes
- Return the media and fonts directories under root's home for root with
use_site_for_root, ignoring the invoking user'sXDG_*_DIR,user-dirs.dirsandXDG_DATA_HOME, and create no inherited media directory underensure_exists(#661) by @gaborbernat. - Raise
ValueErrorfromsite_data_dirandsite_config_dirundermultipath=Truewhenappnameorversioncontainsos.pathsep, rather than returning a string that splits into a directory outside the site base (#662) by @gaborbernat. - Parse an unquoted
user-dirs.dirsvalue with a long run of blanks in linear time, rather than in time quadratic in the run's length on every Unix media directory lookup (#663) by @gaborbernat. - Treat a relative
HOMEas unset on Unix, macOS and iOS, taking the home from the password database or raisingRuntimeError, rather than resolving user directories against the working directory (#664) by @gaborbernat. - Refuse a symlink as
XDG_RUNTIME_DIRinuser_runtime_dirwhen the value ends with/or/., which made the check follow the link (#665) by @gaborbernat. - Redirect
user_*_dircalls withuse_site_for_root=Truewhen the effective uid is 0, so a setuid-root process gets the site directories, and name and check the runtime directory by the effective uid (#666) by @gaborbernat. - Apply the
XDG_RUNTIME_DIRcheck of the Unixuser_runtime_dirto the macOS one, so it no longer uses a directory that is a symlink, owned by another user or not mode0700(#667) by @gaborbernat. - Reject an
XDG_RUNTIME_DIRbelow a parent that another user can replace, such as their own entry in/tmp, instead of creating the runtime directory through it (#668) by @gaborbernat. - Stop accepting a Unix runtime directory that another user creates between the owner check and its use:
ensure_existsandplace_runtime_filecreate it before checking it, andfind_runtime_filechecks it again after a hit (#669) by @gaborbernat. - Raise
PermissionErroron macOS whenensure_existswould create the site cache through a/Library/Caches/$appnamethat is a symlink, not a directory, or owned by a user other than root and the current one (#670) by @gaborbernat. - With
ensure_exists, raiseFileExistsErrorwhen a configured media directory such asuser_documents_diris a regular file or a symlink to one, instead of returning the file's path. Dangling symlinks are still returned unchanged (#672) by @rupayon123 and @gaborbernat.
New Contributors
- @rupayon123 made their first contribution in #672