{"record":{"id":"d6e1419f5c84d4c3","repo":"tursodatabase/turso","slug":"usage-check-elf-dynsym-exports-py-elf-symbol","errorCode":null,"errorMessage":"usage: check_elf_dynsym_exports.py <elf> <symbol>...","messagePattern":"usage: check_elf_dynsym_exports\\.py <elf> <symbol>\\.\\.\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"bindings/dotnet/scripts/check_elf_dynsym_exports.py","lineNumber":20,"sourceCode":"\nimport struct\nimport sys\nfrom pathlib import Path\n\nNAME = 0\nTYPE = 1\nOFFSET = 4\nSIZE = 5\nLINK = 6\nENTRY_SIZE = 9\n\n\ndef main() -> None:\n    if len(sys.argv) == 2 and sys.argv[1] == \"--self-test\":\n        run_self_test()\n        return\n    if len(sys.argv) < 3:\n        raise SystemExit(\"usage: check_elf_dynsym_exports.py <elf> <symbol>...\")\n\n    path = Path(sys.argv[1])\n    needed = sys.argv[2:]\n    missing = missing_exports(path, needed)\n    if missing:\n        raise SystemExit(f\"{path} is missing dynsym exports: {', '.join(missing)}\")\n\n\ndef run_self_test() -> None:\n    import tempfile\n\n    symbol = \"turso_sync_database_new\"\n    with tempfile.NamedTemporaryFile(delete=False, suffix=\".so\") as handle:\n        handle.write(elf64_with_dynsym(symbol))\n        path = Path(handle.name)\n    try:\n        if missing_exports(path, [symbol]):\n            raise SystemExit(\"self-test failed: expected export was not found\")","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/tursodatabase/turso/blob/492c4a71cd7c2649e7df83da1471b74f4b1c7aa9/bindings/dotnet/scripts/check_elf_dynsym_exports.py#L2-L38","documentation":"This script checks that an ELF shared library exports the required symbols in its .dynsym table. The usage error is raised by main() when fewer than 2 command-line arguments are supplied (only the script name and the ELF path, with no symbols to check). SystemExit with a string makes Python print the message and exit with status 1.","triggerScenarios":"Running the script with zero or one argument, e.g. `check_elf_dynsym_exports.py libturso.so` or `check_elf_dynsym_exports.py` — no symbol names given after the ELF path.","commonSituations":"A developer wiring this into CI forgets the symbol list, a build-system variable holding the symbol names expands to empty, or the script is invoked manually to 'see what it does' without arguments.","solutions":["Pass at least one symbol name after the ELF path: check_elf_dynsym_exports.py <elf> <symbol>...","Run with --self-test first to verify the script works without needing a real ELF"],"exampleFix":"// before\ncheck_elf_dynsym_exports.py libturso.so\n// after\ncheck_elf_dynsym_exports.py libturso.so turso_sync_database_new","handlingStrategy":"validation","validationCode":"import sys\nif len(sys.argv) < 3:\n    sys.exit(\"usage: check_elf_dynsym_exports.py <elf> <symbol>...\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the ELF path followed by at least one symbol name","Wrap CI invocations to assert argument count before calling the script","Use --self-test to smoke-test the script without arguments"],"tags":["cli","python","argument-parsing"],"backgroundTag":"missing-cli-argument","analyzedSha":"492c4a71cd7c2649e7df83da1471b74f4b1c7aa9","analyzedAt":"2026-09-13T18:13:59.796Z","contentChangedAt":"2026-09-13T18:13:59.796Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}