Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6d601b8

Browse files
committedAug 26, 2018
[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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Bryan C. Mills <[email protected]> (cherry picked from commit e3106b455b74c91db94e8e1abf2342b5b5aec7b1) Reviewed-on: https://go-review.googlesource.com/131399 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 523dc5a commit 6d601b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/cmd/go/script_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,9 @@ func scriptMatch(ts *testScript, neg bool, args []string, text, name string) {
629629
text = string(data)
630630
}
631631

632+
// Matching against workdir would be misleading.
633+
text = strings.Replace(text, ts.workdir, "$WORK", -1)
634+
632635
if neg {
633636
if re.MatchString(text) {
634637
if isGrep {

0 commit comments

Comments
 (0)
Please sign in to comment.