Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detection of Windows NTFS junction fails if path is a WindowsPath with a lower case drive letter #208

Open
arstorey opened this issue Jan 6, 2021 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@arstorey
Copy link

arstorey commented Jan 6, 2021

In the file helpers.py, function is_dir_link:

When running on Windows, if the path passed in is a WindowsPath with a lower case drive letter then the function will always return True regardless of the existence of the directory or its status as a regular directory or a junction.

This is because:

  1. WindowsPath.resolve() changes the drive letter to upper case while WindowsPath.absolute() doesn't.
  2. The results of path.resolve() and path.absolute() are converted to strings and then compared which fails due to drive letter case being different.

There are two solutions I can think of off the top of my head:

  1. Don't convert the path into two strings, just compare directly as in: if not (path.absolute() == path.resolve())
  2. The strings resulting from path.resolve() and path.absolute() could both be converted to all upper case or all lower case before the comparison is made (NTFS isn't a case sensitive file system so it doesn't matter).
@arstorey arstorey added the bug Something isn't working label Jan 6, 2021
@BradenM BradenM added the help wanted Extra attention is needed label Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants