From: Ian Lance Taylor Date: Sat, 25 Aug 2018 17:11:19 +0000 (-0700) Subject: [release-branch.go1.11] cmd/go: don't let script grep commands match $WORK X-Git-Tag: go1.11.1~23 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=6d601b8a95c209e018db3dfd7af0ac9119cdbbe5;p=gostls13.git [release-branch.go1.11] cmd/go: don't let script grep commands match $WORK If $WORK happens to contain the string that a stdout/stderr/grep command is searching for, a negative grep command will fail incorrectly. Fixes #27170 Fixes #27221 Change-Id: I84454d3c42360fe3295c7235d388381525eb85b4 Reviewed-on: https://go-review.googlesource.com/131398 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Bryan C. Mills (cherry picked from commit e3106b455b74c91db94e8e1abf2342b5b5aec7b1) Reviewed-on: https://go-review.googlesource.com/131399 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go index 389485bc65..7c083a87b9 100644 --- a/src/cmd/go/script_test.go +++ b/src/cmd/go/script_test.go @@ -629,6 +629,9 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) { text = string(data) } + // Matching against workdir would be misleading. + text = strings.Replace(text, ts.workdir, "$WORK", -1) + if neg { if re.MatchString(text) { if isGrep {