Skip to content

probe symbols/query silently drops entire files on #ifdef-heavy C (0 functions for acls.c, checksum.c, etc.) #577

Closed

Description

@buger

Bug

probe symbols and probe query silently return zero functions for C files with heavy #ifdef preprocessor directives — despite those files containing 12-39 function definitions each. No error or warning is emitted.

Reproduction

# These 5 production files all return 0 functions:
for f in checksum.c acls.c compat.c hlink.c xattrs.c; do
    count=$(probe symbols --format json "$f" | python3 -c "
import sys,json
print(sum(1 for x in json.load(sys.stdin) if x.get('kind')=='function'))
" 2>/dev/null)
    echo "$f: probe=$count functions"
done

Expected

Each file should return its actual function definitions (verified by ground-truth regex):

File probe finds Actual function defs
checksum.c 0 14
acls.c 0 39
compat.c 0 18
hlink.c 0 12
xattrs.c 0 28
Total missed 0 111

Actual

All 5 files return 0 functions — silently. No error, no warning.

Root cause (preliminary)

The tree-sitter C parser appears to bail after the leading extern/declaration block when it hits heavy #ifdef directives inside struct initializers or tables (e.g. checksum.c:52 has valid_checksums_items[] with #ifdef guards inside the array initializer). After the parse failure, probe symbols emits only the pre-failure declarations and silently stops.

probe query shares the same tree-sitter parser, so it has the same failure — it's not a fallback.

Impact

Critical for proof's function-enumeration use cases (e.g. property-based-test coverage checks). 111 function definitions silently missed across 5 production files. A "0 functions" result must be treated as a hard error, not "empty file" — otherwise coverage gaps are masked.

Environment

  • probe-code 0.6.0
  • macOS darwin (arm64)
  • Tested on rsync 3.5.0 C codebase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions