Commit f2ed3e1d authored by Ian Lance Taylor's avatar Ian Lance Taylor

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 <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
parent e03220a5
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment