Skip to content

Commit 48e2836

Browse files
committed
Don't collect nix-expr-test crashes
1 parent 38df301 commit 48e2836

File tree

5 files changed

+54
-11
lines changed

5 files changed

+54
-11
lines changed

dist/index.d.ts

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 21 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/backtrace.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,30 @@ const START_SLOP_SECONDS = 5;
1515

1616
export async function collectBacktraces(
1717
prefixes: string[],
18+
programNameDenyList: string[],
1819
startTimestampMs: number,
1920
): Promise<Map<string, string>> {
2021
if (isMacOS) {
21-
return await collectBacktracesMacOS(prefixes, startTimestampMs);
22+
return await collectBacktracesMacOS(
23+
prefixes,
24+
programNameDenyList,
25+
startTimestampMs,
26+
);
2227
}
2328
if (isLinux) {
24-
return await collectBacktracesSystemd(prefixes, startTimestampMs);
29+
return await collectBacktracesSystemd(
30+
prefixes,
31+
programNameDenyList,
32+
startTimestampMs,
33+
);
2534
}
2635

2736
return new Map();
2837
}
2938

3039
export async function collectBacktracesMacOS(
3140
prefixes: string[],
41+
programNameDenyList: string[],
3242
startTimestampMs: number,
3343
): Promise<Map<string, string>> {
3444
const backtraces: Map<string, string> = new Map();
@@ -80,6 +90,11 @@ export async function collectBacktracesMacOS(
8090
.filter((fileName) => {
8191
return prefixes.some((prefix) => fileName.startsWith(prefix));
8292
})
93+
.filter((fileName) => {
94+
return !programNameDenyList.some((programName) =>
95+
fileName.startsWith(`${programName}_${new Date().getFullYear()}`),
96+
);
97+
})
8398
.filter((fileName) => {
8499
// macOS creates .diag files periodically, which are called "microstackshots".
85100
// We don't necessarily want those, and they're definitely not crashes.
@@ -117,6 +132,7 @@ type SystemdCoreDumpInfo = {
117132

118133
export async function collectBacktracesSystemd(
119134
prefixes: string[],
135+
programNameDenyList: string[],
120136
startTimestampMs: number,
121137
): Promise<Map<string, string>> {
122138
const sinceSeconds =
@@ -150,7 +166,10 @@ export async function collectBacktracesSystemd(
150166
const execParts = sussyObject.exe.split("/");
151167
const binaryName = execParts[execParts.length - 1];
152168

153-
if (prefixes.some((prefix) => binaryName.startsWith(prefix))) {
169+
if (
170+
prefixes.some((prefix) => binaryName.startsWith(prefix)) &&
171+
!programNameDenyList.includes(binaryName)
172+
) {
154173
coredumps.push({
155174
exe: sussyObject.exe,
156175
pid: sussyObject.pid,

src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ export type ActionOptions = {
130130
//
131131
// Default: `[ "nix", "determinate-nixd", ActionOptions.name ]`.
132132
binaryNamePrefixes?: string[];
133+
134+
// Do NOT collect backtraces from segfaults and other failures from binaries with exact these names.
135+
//
136+
// Default: `[ "nix-expr-tests" ]`.
137+
binaryNamesDenyList?: string[];
133138
};
134139

135140
/**
@@ -144,6 +149,7 @@ export type ConfidentActionOptions = {
144149
requireNix: NixRequirementHandling;
145150
providedDiagnosticsUrl?: URL;
146151
binaryNamePrefixes: string[];
152+
binaryNamesDenyList: string[];
147153
};
148154

149155
/**
@@ -893,6 +899,7 @@ export abstract class DetSysAction {
893899

894900
const backtraces = await collectBacktraces(
895901
this.actionOptions.binaryNamePrefixes,
902+
this.actionOptions.binaryNamesDenyList,
896903
parseInt(actionsCore.getState(STATE_BACKTRACE_START_TIMESTAMP)),
897904
);
898905
actionsCore.debug(`Backtraces identified: ${backtraces.size}`);
@@ -1066,6 +1073,7 @@ function makeOptionsConfident(
10661073
"determinate-nixd",
10671074
actionOptions.name,
10681075
],
1076+
binaryNamesDenyList: actionOptions.binaryNamePrefixes ?? ["nix-expr-tests"],
10691077
};
10701078

10711079
actionsCore.debug("idslib options:");

0 commit comments

Comments
 (0)