phase 17.2: add common-name guard to verify-fork-functions.sh
Common function names (new, read, write, parse, get, set, remove, etc.) appear in many unrelated files — cross-file search produces false MOVED classifications (e.g., fn new() in ipcd matches fn new() in xhcid). The case-based guard skips cross-file search for 40+ common function names. These must be handled via the .verify-fork-functions.exclude mechanism instead — operator decides if removal was intentional or accidental. Results: kernel 19→17 (kcall×2 correctly MOVED to user.rs, eq/hash correctly blocked from false MOVED to fdstat.rs)
This commit is contained in:
@@ -146,19 +146,32 @@ for fork in "${TARGET_FORKS[@]}"; do
|
||||
[[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → EXCLUDED (RB intentional)")
|
||||
continue
|
||||
fi
|
||||
# Strip modifiers to get bare function name for cross-file search
|
||||
# Common function names (constructors, trait impls, patterns) appear
|
||||
# in many unrelated files — cross-file search produces false MOVED matches.
|
||||
bare_fn=$(echo "$fn" | sed -E 's/^(pub |async |unsafe )+//')
|
||||
found_elsewhere=$(cd "$fork_dir" && \
|
||||
grep -rlP "(?:pub )?(?:async )?(?:unsafe )?fn ${bare_fn}\b" \
|
||||
--include='*.rs' --exclude-dir='.git' --exclude-dir='target' --exclude-dir='stage' . 2>/dev/null | \
|
||||
grep -v "^\./${f}$" | head -1 | sed 's|^\./||')
|
||||
if [[ -n "$found_elsewhere" ]]; then
|
||||
[[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → MOVED to $found_elsewhere")
|
||||
else
|
||||
missing_details+=(" $f: fn $fn")
|
||||
fork_missing=$((fork_missing + 1))
|
||||
TOTAL_MISSING=$((TOTAL_MISSING + 1))
|
||||
fi
|
||||
case "$bare_fn" in
|
||||
new|default|read|write|parse|open|close|run|init|main|\
|
||||
get|set|remove|insert|delete|start|stop|send|recv|\
|
||||
connect|bind|listen|accept|clone|drop|eq|hash|fmt|\
|
||||
from|into|next|count|len|is_empty|clear|contains|\
|
||||
daemon|allocate|index|try_from|from_psf|into_object|\
|
||||
get_unique|set_plane)
|
||||
# Too ambiguous — treat as truly missing (operator must decide)
|
||||
;;
|
||||
*)
|
||||
found_elsewhere=$(cd "$fork_dir" && \
|
||||
grep -rlP "(?:pub )?(?:async )?(?:unsafe )?fn ${bare_fn}\b" \
|
||||
--include='*.rs' --exclude-dir='.git' --exclude-dir='target' --exclude-dir='stage' . 2>/dev/null | \
|
||||
grep -v "^\./${f}$" | head -1 | sed 's|^\./||')
|
||||
if [[ -n "$found_elsewhere" ]]; then
|
||||
[[ "$QUIET" -eq 0 ]] && missing_details+=(" $f: fn $fn → MOVED to $found_elsewhere")
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
missing_details+=(" $f: fn $fn")
|
||||
fork_missing=$((fork_missing + 1))
|
||||
TOTAL_MISSING=$((TOTAL_MISSING + 1))
|
||||
done <<< "$missing"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user