mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 15:28:34 +01:00
doctor: fixes unknown cache directory error on some windows mapped network shares (#6364)
* doctor: fixes unknown cache director error on some windows mapped network shares On Windows, resolve calls os.path._getfinalpathname, which calls GetFinalPathNameByHandle. This starts from the final resolved path of the file in the NT namespace (e.g. \Device\Mup\server\share...) and works backward as required to get the VOLUME_NAME_DOS. If the final path is a UNC share (i.e. \Device\Mup), We fix this by calling resolve() also on the partition mountpoints We also take the opportunity to make checks in case a PermissionError is returned to us Fixes github.com/iterative/dvc/issues/6305 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * doctor: fixes unknown cache director error on some windows mapped network shares On Windows, resolve calls os.path._getfinalpathname, which calls GetFinalPathNameByHandle. This starts from the final resolved path of the file in the NT namespace (e.g. \Device\Mup\server\share...) and works backward as required to get the VOLUME_NAME_DOS. If the final path is a UNC share (i.e. \Device\Mup), We fix this by calling resolve() also on the partition mountpoints We also take the opportunity to make checks in case a PermissionError is returned to us Fixes #6305 Co-authored-by: CHETOUAN <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: CHETOUAN <[email protected]>
This commit is contained in:
co-authored by
CHETOUAN
pre-commit-ci[bot]
CHETOUAN
parent
e58fcd864b
commit
20bb6ddf3c
+8
-5
@@ -136,11 +136,14 @@ def _get_supported_remotes():
|
||||
|
||||
|
||||
def get_fs_type(path):
|
||||
|
||||
partition = {
|
||||
pathlib.Path(part.mountpoint): (part.fstype + " on " + part.device)
|
||||
for part in psutil.disk_partitions(all=True)
|
||||
}
|
||||
partition = {}
|
||||
for part in psutil.disk_partitions(all=True):
|
||||
if part.fstype != "":
|
||||
try:
|
||||
mountpoint = pathlib.Path(part.mountpoint).resolve()
|
||||
partition[mountpoint] = part.fstype + " on " + part.device
|
||||
except PermissionError:
|
||||
pass
|
||||
|
||||
# need to follow the symlink: https://github.com/iterative/dvc/issues/5065
|
||||
path = pathlib.Path(path).resolve()
|
||||
|
||||
Reference in New Issue
Block a user