George Burgess IV | cbc852e | 2021-01-25 13:11:02 -0800 | [diff] [blame] | 1 | // Copyright 2021 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | package main |
| 5 | |
| 6 | import ( |
| 7 | "bytes" |
| 8 | "strings" |
| 9 | ) |
| 10 | |
| 11 | // crbug.com/1166017 |
| 12 | |
| 13 | const kernelBugRetryLimit = 25 |
| 14 | |
| 15 | // GCC will sometimes fail to wait on subprocesses due to this kernel bug. It always fails the |
| 16 | // compilation and prints "Unknown error 512" in that case. |
| 17 | func containsTracesOfKernelBug(buf []byte) bool { |
| 18 | return bytes.Contains(buf, []byte("Unknown error 512")) |
| 19 | } |
| 20 | |
| 21 | func errorContainsTracesOfKernelBug(err error) bool { |
| 22 | // We'll get errors that look like "waitid: errno 512." Presumably, this isn't specific to |
| 23 | // waitid, so just try to match the "errno 512" ending. |
| 24 | return err != nil && strings.HasSuffix(err.Error(), "errno 512") |
| 25 | } |