diff options
author | Ian Lance Taylor <iant@golang.org> | 2018-08-25 10:11:19 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2018-08-25 18:36:22 +0000 |
commit | f2ed3e1da16ba02543268b14d962e1026257604e (patch) | |
tree | 177cb8671e35afd481f1193b8246519e5f659222 /src/cmd | |
parent | e03220a594a1a4b7fa8c901eebddb9ea11ecbece (diff) | |
download | go-git-f2ed3e1da16ba02543268b14d962e1026257604e.tar.gz |
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: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r-- | src/cmd/go/script_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
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 { |