blob: 55817cb62d5b2e38ca35a0994c3d2bf78533aa9d [file] [log] [blame]
George Burgess IVcbc852e2021-01-25 13:11:02 -08001// 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.
4package main
5
6import (
7 "bytes"
8 "strings"
9)
10
11// crbug.com/1166017
12
13const 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.
17func containsTracesOfKernelBug(buf []byte) bool {
18 return bytes.Contains(buf, []byte("Unknown error 512"))
19}
20
21func 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}