Skip to content

Add subst drive resolution to Kotlin and Go extractors#22107

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/add-kotlin-go-extractor-support
Draft

Add subst drive resolution to Kotlin and Go extractors#22107
Copilot wants to merge 4 commits into
mainfrom
copilot/add-kotlin-go-extractor-support

Conversation

Copilot AI commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

This updates the Kotlin and Go extractors to resolve Windows subst drive letters via the shared canonicalize.dll shipped in the CLI distribution. Both extractors now canonicalize paths past the substituted drive root instead of preserving the synthetic drive letter.

  • Kotlin extractor

    • Add com.semmle.util.files.SubstResolver in java/kotlin-extractor
    • Load $CODEQL_DIST/tools/win64/canonicalize.dll on Windows
    • Expose a JNI-backed nativeResolveSubst hook
    • Apply subst resolution as the final step in FileUtil.tryMakeCanonical
  • Go extractor

    • Add go/extractor/subst package
    • Load the same DLL from CODEQL_DIST
    • Call the UTF-8 resolve_subst_u8 / resolve_subst_free_u8 exports on Windows
    • Keep non-Windows behavior as a no-op
  • Go path normalization integration

    • Update extractor file path normalization to run subst.ResolvePath(...) after existing symlink canonicalization
    • Add Bazel wiring for the new package
  • Coverage

    • Add focused Go tests for drive-root detection and path rewriting behavior

Example of the new path rewrite:

path, err := filepath.EvalSymlinks(file)
if err != nil {
    path = file
}
return subst.ResolvePath(path)

Copilot AI changed the title [WIP] Add Kotlin and Go extractor support for Windows subst drive letters Add subst drive resolution to Kotlin and Go extractors Jul 2, 2026
Copilot AI requested a review from jketema July 2, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants