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

posix: Evaluate UNC path support. #1620

Closed
harshavardhana opened this issue May 12, 2016 · 11 comments
Closed

posix: Evaluate UNC path support. #1620

harshavardhana opened this issue May 12, 2016 · 11 comments
Assignees

Comments

@harshavardhana
Copy link
Member

https://blog.klauspost.com/long-windows-paths-unc-paths-in-go/

import "strings"
import "regexp"

// Pattern to match a windows absolute path: "c:\" and similar
var isAbsWinDrive = regexp.MustCompile(`^[a-zA-Z]\:\\`)

// UncPath converts an absolute Windows path
// to a UNC long path.
func UncPath(s string) string {
    // UNC can NOT use "/", so convert all to "\"
    s = strings.Replace(s, `/`, `\`, -1)

    // If prefix is "\\", we already have a UNC path or server.
    if strings.HasPrefix(s, `\\`) {

        // If already long path, just keep it
        if strings.HasPrefix(s, `\\?\`) {
            return s
        }

        // Trim "\\" from path and add UNC prefix.
        return "\\\\?\UNC\\" + strings.TrimPrefix(s, `\\`)
    }

    if isAbsWinDrive.MatchString(s) {
        return `\\?\` + s
    }

    return s
}

If it is any consolation, dot net users have the same issue - https://github.com/dotnet/corefx/issues/645

@harshavardhana
Copy link
Member Author

This is a bug to track future support on this particular behavior - golang/go#10900

@harshavardhana
Copy link
Member Author

In future support this - https://github.com/golang/sys/windows

@balamurugana
Copy link
Member

See also golang/go#3358

@harshavardhana
Copy link
Member Author

See also golang/go#3358

We need to get to a point somewhere in future to support it and also possibly contribute upstream eventually.

@balamurugana
Copy link
Member

UNC path support needs to be added to golang core libraries to address this issue. For more information, see golang/go#3358

@balamurugana
Copy link
Member

As per our discussion, we don't work with UNC path till there is a golang support. This issue can be closed.

@harshavardhana
Copy link
Member Author

harshavardhana commented Jun 9, 2016

As per our discussion, we don't work with UNC path till there is a golang support. This issue can be closed.

Removing this bug from standalone server release keeping this bug for future work.

harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
This allows us to now use 32K length names.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
This allows us to now use 32K length names.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
This allows us to now use 32K length names.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
This allows us to now use 32K length names.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 9, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
@harshavardhana
Copy link
Member Author

Took the liberty of fixing it, and it works - fixed by #1887

harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 10, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
@harshavardhana
Copy link
Member Author

#1887 - 260 path limit on windows is fixed, now we have 32K path limit - unit tests have been updated as well. Please review the patch.

@abperiasamy
Copy link
Member

Does os.Remove and similar functions support UNC path argument?

@harshavardhana
Copy link
Member Author

Does os.Remove and similar functions support UNC path argument?

Yes they all do.

harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 11, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 11, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 13, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 13, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
harshavardhana added a commit to harshavardhana/minio that referenced this issue Jun 13, 2016
This allows us to now use 32K paths names on windows.

Fixes minio#1620
abperiasamy pushed a commit that referenced this issue Jun 13, 2016
This allows us to now use 32K paths names on windows.

Fixes #1620
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants