mirror of
https://github.com/golang/go
synced 2024-11-18 06:04:53 -07:00
go/build: allow % in ${SRCDIR} expansion for Jenkins
Fixes #16959. Change-Id: Ibbb28fdf26c53788a0edb3e3ea54ec030fa2a8cf Reviewed-on: https://go-review.googlesource.com/31611 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
86324f29c6
commit
157ce90abe
@ -1294,7 +1294,8 @@ func expandSrcDir(str string, srcdir string) (string, bool) {
|
|||||||
// We never pass these arguments to a shell (just to programs we construct argv for), so this should be okay.
|
// We never pass these arguments to a shell (just to programs we construct argv for), so this should be okay.
|
||||||
// See golang.org/issue/6038.
|
// See golang.org/issue/6038.
|
||||||
// The @ is for OS X. See golang.org/issue/13720.
|
// The @ is for OS X. See golang.org/issue/13720.
|
||||||
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@"
|
// The % is for Jenkins. See golang.org/issue/16959.
|
||||||
|
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%"
|
||||||
const safeSpaces = " "
|
const safeSpaces = " "
|
||||||
|
|
||||||
var safeBytes = []byte(safeSpaces + safeString)
|
var safeBytes = []byte(safeSpaces + safeString)
|
||||||
|
@ -294,6 +294,7 @@ func TestShellSafety(t *testing.T) {
|
|||||||
result bool
|
result bool
|
||||||
}{
|
}{
|
||||||
{"-I${SRCDIR}/../include", "/projects/src/issue 11868", "-I/projects/src/issue 11868/../include", true},
|
{"-I${SRCDIR}/../include", "/projects/src/issue 11868", "-I/projects/src/issue 11868/../include", true},
|
||||||
|
{"-I${SRCDIR}", "wtf$@%", "-Iwtf$@%", true},
|
||||||
{"-X${SRCDIR}/1,${SRCDIR}/2", "/projects/src/issue 11868", "-X/projects/src/issue 11868/1,/projects/src/issue 11868/2", 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", false},
|
{"-I/tmp -I/tmp", "/tmp2", "-I/tmp -I/tmp", false},
|
||||||
{"-I/tmp", "/tmp/[0]", "-I/tmp", true},
|
{"-I/tmp", "/tmp/[0]", "-I/tmp", true},
|
||||||
|
Loading…
Reference in New Issue
Block a user