]> Cypherpunks repositories - gostls13.git/commitdiff
go/build: allow ~ and ^ in #cgo directives for sr.ht import paths
authorElias Naur <mail@eliasnaur.com>
Wed, 9 Oct 2019 09:13:42 +0000 (11:13 +0200)
committerElias Naur <mail@eliasnaur.com>
Wed, 9 Oct 2019 14:03:15 +0000 (14:03 +0000)
Fixes #32260

Change-Id: Ib44ee33b8143d523875cf5a2bc5e36bf082801a4
Reviewed-on: https://go-review.googlesource.com/c/go/+/199918
Run-TryBot: Elias Naur <mail@eliasnaur.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Jay Conrod <jayconrod@google.com>
src/go/build/build.go
src/go/build/build_test.go

index 722fead20ee0de8cb7a7d86bd2e6acb286ad29aa..097ad3c2ec50924f38c3c346f15b110ac2a4cec1 100644 (file)
@@ -1552,7 +1552,8 @@ func (ctxt *Context) makePathsAbsolute(args []string, srcDir string) {
 // The @ is for OS X. See golang.org/issue/13720.
 // The % is for Jenkins. See golang.org/issue/16959.
 // The ! is because module paths may use them. See golang.org/issue/26716.
-const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! "
+// The ~ and ^ are for sr.ht. See golang.org/issue/32260.
+const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%! ~^"
 
 func safeCgoName(s string) bool {
        if s == "" {
index cfcb8167a1abfb25222e94a8b8b8cfd75ca37523..cff091f894caff122c59c96c90d564de9c8cf152 100644 (file)
@@ -295,7 +295,7 @@ func TestShellSafety(t *testing.T) {
                result                  bool
        }{
                {"-I${SRCDIR}/../include", "/projects/src/issue 11868", "-I/projects/src/issue 11868/../include", true},
-               {"-I${SRCDIR}", "wtf$@%", "-Iwtf$@%", true},
+               {"-I${SRCDIR}", "~wtf$@%^", "-I~wtf$@%^", true},
                {"-X${SRCDIR}/1,${SRCDIR}/2", "/projects/src/issue 11868", "-X/projects/src/issue 11868/1,/projects/src/issue 11868/2", true},
                {"-I/tmp -I/tmp", "/tmp2", "-I/tmp -I/tmp", true},
                {"-I/tmp", "/tmp/[0]", "-I/tmp", true},