]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go/internal/modload: treat \ as a path separator instead of a shell special character
authorSataQiu <shidaqiu2018@gmail.com>
Thu, 15 Apr 2021 15:39:30 +0000 (23:39 +0800)
committerBryan C. Mills <bcmills@google.com>
Tue, 27 Apr 2021 21:16:55 +0000 (21:16 +0000)
According to the code comment, \ should be treated as a path separator.
See fileNameOK in golang.org/x/mod/module/module.go.

Change-Id: I05e05246005191ecccfecf46848aba5cb1359956
Reviewed-on: https://go-review.googlesource.com/c/go/+/310429
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Trust: Robert Findley <rfindley@google.com>

src/cmd/go/internal/modload/init.go

index 4d240a7b6445e52e8e932af6f0df992f16d6cf82..3c7db6c8a7f81838730d630b1852405f349fdbcb 100644 (file)
@@ -554,7 +554,7 @@ func checkModulePathLax(p string) error {
        // with file systems and subcommands. Disallow file path separators : and \
        // because path separators other than / will confuse the module cache.
        // See fileNameOK in golang.org/x/mod/module/module.go.
-       shellChars := "`" + `\"'*<>?|`
+       shellChars := "`" + `"'*<>?|`
        fsChars := `\:`
        if i := strings.IndexAny(p, shellChars); i >= 0 {
                return errorf("contains disallowed shell character %q", p[i])