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

Improve support for UNC paths #98

Open
fekir opened this issue Dec 10, 2024 · 4 comments
Open

Improve support for UNC paths #98

fekir opened this issue Dec 10, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@fekir
Copy link

fekir commented Dec 10, 2024

mc seems to only partially support UNC paths, which are sometimes required for accessing specific files and folders.

# does not start mc in the C:\ folder
mc "\\?\C:\"

# start mc in the C:\Users folder
mc "\\?\C:\Users"

in the second case, the content of the directory is not shown correctly

{D35DEE7C-AE50-4E35-9D13-04D9EE724A2C}

Typing cd \\?\C:\Users command in mc causes an error, while cd C:\Users works

{CA1062EB-B9BF-4CA0-9AA5-299440500C69}

@adamyg
Copy link
Owner

adamyg commented Dec 10, 2024

Attempt to utilize forward not backlashes, currently limited to network drives "\\server\share\path\file"

https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN

`the "\?" prefix to a path string tells the Windows APIs to disable all string parsing and to send the string that follows it straight to the file system. For example, if the file system supports large paths and file names, you can exceed the MAX_PATH limits that are otherwise enforced by the Windows APIs.

Because it turns off automatic expansion of the path string, the "\?" prefix also allows the use of ".." and "." in the path names, which can be useful if you are attempting to perform operations on a file with these otherwise reserved relative path specifiers as part of the fully qualified path.
`

Not a conventional path. The internals of mc wont support file names using the "." and ".." within paths, these shall always be treated and current and sub-directory.

Shall review the path parser, only option ignore leading "//?" and "\\?", treat remaining as a normal path.

@adamyg adamyg added the bug Something isn't working label Dec 10, 2024
@fekir
Copy link
Author

fekir commented Dec 10, 2024

Shall review the path parser, only option ignore leading "//?" and "\?", treat remaining as a normal path.

While it fixes the issue presented here, a better solution would be to fully support it.

Currently mc seem unable to access in any was a folder named, for example, test. (leading dot), which is accessible from the shell (powershell) when using UNC.
Other programs (cygwin shell, far file manager, ...) do not even need to use UNC paths for accessing it (as they do the conversion internally, providing a more consistent experience to the end-user)

@fekir
Copy link
Author

fekir commented Dec 10, 2024

For completeness, in case of a folder ending with . the content is not shown correctly

{56CD8C17-935B-4909-9047-0E6F0F6536A5}

The folder ab. is shown colored as ?ab., and the permission are missing.
The folder test, which is in the same directory, is shown correctly.

Pressing enter on ab. shows following dialog

{B3C26773-5644-4FCB-9FBA-5FBE8FB2D708}

@adamyg
Copy link
Owner

adamyg commented Dec 10, 2024

Appreciate the feedback, shall see what is practical within confines of the mc-core engine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants