[go] cmd/go/internal/modload: treate \ as a path separator instead of a shell special character

2 views
Skip to first unread message

Bryan C. Mills (Gerrit)

unread,
Apr 27, 2021, 5:17:01 PM4/27/21
to Sata Qiu, Bryan C. Mills, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Robert Findley, Go Bot, Michael Matloob, golang-co...@googlegroups.com

Bryan C. Mills submitted this change.

View Change

Approvals: Bryan C. Mills: Looks good to me, approved Robert Findley: Trusted
cmd/go/internal/modload: treat \ as a path separator instead of a shell special character

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 <bcm...@google.com>
Trust: Robert Findley <rfin...@google.com>
---
M src/cmd/go/internal/modload/init.go
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go
index 4d240a7..3c7db6c 100644
--- a/src/cmd/go/internal/modload/init.go
+++ b/src/cmd/go/internal/modload/init.go
@@ -554,7 +554,7 @@
// 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])

To view, visit change 310429. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I05e05246005191ecccfecf46848aba5cb1359956
Gerrit-Change-Number: 310429
Gerrit-PatchSet: 3
Gerrit-Owner: Sata Qiu <shidaq...@gmail.com>
Gerrit-Reviewer: Bryan C. Mills <bcm...@google.com>
Gerrit-Reviewer: Go Bot <go...@golang.org>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-Reviewer: Robert Findley <rfin...@google.com>
Gerrit-MessageType: merged
Reply all
Reply to author
Forward
0 new messages