Skip to content

Conversation

@pythonspeaker
Copy link
Contributor

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), it returns a path of the form ?\UNC\server\share.... pathlib translates this back to a regular UNC path of the form \server\share....
We fix this by calling resolve() also on the partition mountpoints and we also take the opportunity to make checks in case a PermissionError is returned to us

Fixes #6305

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

CHETOUAN and others added 2 commits July 13, 2021 13:48
…work 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/treeverse/issues/6305
@pythonspeaker pythonspeaker requested a review from a team as a code owner July 27, 2021 09:13
@pythonspeaker pythonspeaker requested a review from skshetry July 27, 2021 09:13
pre-commit-ci bot and others added 2 commits July 27, 2021 09:14
…work 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 treeverse#6305
@karajan1001
Copy link
Contributor

The only problem is that hard to test it, and I can only get my NAS next weekend.

}
partition = {}
for part in psutil.disk_partitions(all=True):
if part.fstype != "":
Copy link
Contributor

@efiop efiop Jul 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that psutil was not able to regognize fstype? If so, should we mark it as unknown then?

Could you elaborate on what part.mountpoint this happens on for you? On nas share or on something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, in some cases I had an empty fstype, I haven't managed to reproduce the error since but I'm sure it exists. That's why I added this check just in case. And yes you are right! It's better to mark it as "unknown" if that's the case, I can fix that if you want?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Yeah, if part.mountpoint is present and meaningful, let's adjust that to unknown, should make more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello ! Sorry for the delay... I looked again in the code and I think this case is already well managed, at dvc/info.py line 151, we're already returning "unknown" if we can't find what we want in our partition dict.
It looks good to me, what do you think ?

@skshetry skshetry requested review from efiop and removed request for skshetry August 2, 2021 08:52
@karajan1001
Copy link
Contributor

Sorry for late I will try it on my windows computer in this week end

@pythonspeaker
Copy link
Contributor Author

Sorry for late I will try it on my windows computer in this week end

No problem, I will also be available this weekend if you need me.
See you soon!

@karajan1001
Copy link
Contributor

karajan1001 commented Aug 16, 2021

Current master

image

After this PR.

image

The workspace shows correctly. Thank you.

Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @anasitomtn !

@efiop efiop merged commit 20bb6dd into treeverse:master Oct 2, 2021
@efiop efiop added the bugfix fixes bug label Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix fixes bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doctor: unknown workspace and cache directory on some windows mapped network shares

3 participants