-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Windows UNC paths do not work for some config settings #2845
Comments
I've done a bit more digging and think that we could get away with only fixing the one call to path.Clean in the code base. It is in RepoRootPath = path.Clean(RepoRootPath) I've experimented a bit and go is very forgiving when it comes to accessing file shares. You can specify either slash (forward or backward) as long as there are two at the start of the UNC server name. And you can mix slashes within a path. So all of these work, and point to the same file:
It is the call to path.Clean I noted above that is causing the problem. I think we can ignore wherever path.Join is being used for creating filesystem paths, even for windows. |
@MCF I have tried this: https://play.golang.org/p/-lnGrBxlM0. Try to use double (escaped) backslashes please. |
@Morlinest I did try that when I first encoutered the problem. Unfortunately you cannot use backslashes in app.ini. Only front slashes are allowed. See the forcePathSeparator function in |
[x]
):Something like:
2017/11/03 13:22:19 [...ules/context/repo.go:335 func1()] [E] RepoAssignment Invalid repo \mycifsserver\mywindowsshare\repositories\orgname\reponame.git: no such file or directory
Description
It is impossible to use windows UNC names (aka windows file shares) in the repository ROOT setting. The UNC name has the double slashes at the start converted to a single slash. For example:
Will be converted into:
I've inspected the code and the
Package path implements utility routines for manipulating slash-separated paths.path
package is used in many places to Clean or Join paths, including where the ROOT setting is read.path
will not do the right thing on Windows, insteadfilepath
should be used. From the docs for path:The path package should only be used for paths separated by forward slashes, such as the paths in URLs. This package does not deal with Windows paths with drive letters or backslashes; to manipulate operating system paths, use the path/filepath package.
The text was updated successfully, but these errors were encountered: