Skip to content

Commit 157ce90

Browse files
committed
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 86324f2 commit 157ce90

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/go/build/build.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,8 @@ func expandSrcDir(str string, srcdir string) (string, bool) {
12941294
// We never pass these arguments to a shell (just to programs we construct argv for), so this should be okay.
12951295
// See golang.org/issue/6038.
12961296
// The @ is for OS X. See golang.org/issue/13720.
1297-
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@"
1297+
// The % is for Jenkins. See golang.org/issue/16959.
1298+
const safeString = "+-.,/0123456789=ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz:$@%"
12981299
const safeSpaces = " "
12991300

13001301
var safeBytes = []byte(safeSpaces + safeString)

src/go/build/build_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ func TestShellSafety(t *testing.T) {
294294
result bool
295295
}{
296296
{"-I${SRCDIR}/../include", "/projects/src/issue 11868", "-I/projects/src/issue 11868/../include", true},
297+
{"-I${SRCDIR}", "wtf$@%", "-Iwtf$@%", true},
297298
{"-X${SRCDIR}/1,${SRCDIR}/2", "/projects/src/issue 11868", "-X/projects/src/issue 11868/1,/projects/src/issue 11868/2", true},
298299
{"-I/tmp -I/tmp", "/tmp2", "-I/tmp -I/tmp", false},
299300
{"-I/tmp", "/tmp/[0]", "-I/tmp", true},

0 commit comments

Comments
 (0)