Answers Filbert's round 1 (#1518 comment 26724): launch.by must hold role.launch, launch is null when limits.authority drops it, a test for cross-role narrowing, and the business file checked on its open descriptor. Co-Authored-By: Claude Opus 5.5 <[email protected]>
22 lines
1.9 KiB
Bash
22 lines
1.9 KiB
Bash
#!/bin/bash
|
||
# Round 2 mutants: each edits one source file in a copy, runs the business tests, restores.
|
||
cd ~/darkwing-scratch/s1-mut
|
||
export TMPDIR=~/darkwing-scratch/tmp
|
||
run() { # name file python-replace-old python-replace-new
|
||
local name=$1 file=$2
|
||
cp "$file" "$file.orig"
|
||
python3 -c "import sys;p=sys.argv[1];s=open(p).read();o=sys.argv[2];n=sys.argv[3];assert o in s,'pattern missing';open(p,'w').write(s.replace(o,n,1))" "$file" "$3" "$4" || { echo "$name: PATTERN MISSING"; mv "$file.orig" "$file"; return; }
|
||
local fails
|
||
fails=$(node --test packages/business/tests/ 2>&1 | sed -n 's/^ℹ fail //p')
|
||
mv "$file.orig" "$file"
|
||
if [ "${fails:-0}" -gt 0 ]; then echo "$name: killed ($fails)"; else echo "$name: SURVIVED"; fi
|
||
}
|
||
run R1-launcher-role-check-off packages/business/src/business.mjs 'if (!launcher.authority.withinRole.includes("role.launch")) {' 'if (false) {'
|
||
run R2-launch-ignores-narrowing packages/business/src/resolve.mjs ' && withinRole.includes("role.launch") ?' ' ?'
|
||
run R3-filbert-M3-crossRole-not-narrowed packages/business/src/resolve.mjs ' crossRole = crossRole.filter((a) => vars["limits.authority"].includes(a));' ''
|
||
run R4-stat-check-skipped packages/business/src/util.mjs ' checkStat?.(stat);' ''
|
||
run R5-stat-check-after-parse packages/business/src/util.mjs $' checkStat?.(stat);\n text = readFileSync(fd, "utf8");\n } finally {\n closeSync(fd);\n }\n try {\n return JSON.parse(text);' $' text = readFileSync(fd, "utf8");\n } finally {\n closeSync(fd);\n }\n try {\n const parsed = JSON.parse(text); checkStat?.(fstatSync(openSync(file, "r"))); return parsed;'
|
||
run R6-follows-links packages/business/src/util.mjs ' | constants.O_NOFOLLOW' ''
|
||
run R7-not-regular-accepted packages/business/src/util.mjs ' if (!stat.isFile()) refuse' ' if (false) refuse'
|
||
run R8-fifo-blocks packages/business/src/util.mjs ' | constants.O_NONBLOCK' ''
|