aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/kernel_bug.go
blob: 857dae014d5303a54e51b96d378d7f38fb4f788f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright 2021 The ChromiumOS Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package main

import (
	"bytes"
	"strings"
)

// crbug.com/1166017

const kernelBugRetryLimit = 25

// GCC will sometimes fail to wait on subprocesses due to this kernel bug. It always fails the
// compilation and prints "Unknown error 512" in that case.
func containsTracesOfKernelBug(buf []byte) bool {
	return bytes.Contains(buf, []byte("Unknown error 512"))
}

func errorContainsTracesOfKernelBug(err error) bool {
	// We'll get errors that look like "waitid: errno 512." Presumably, this isn't specific to
	// waitid, so just try to match the "errno 512" ending.
	return err != nil && strings.HasSuffix(err.Error(), "errno 512")
}