Skip to content

Conversation

@bnbarham
Copy link
Contributor

CompilationDatabaseTests have been flakey on Windows since #2334. This didn't really introduce the failure though - it just added tests that now catch it.

The underlying cause is that filename.isAbsolutePath sometimes returns true for a relative path, which then causes the CWD to be prepended instead of the given compileCommandsDirectory.

PathIsRelativeW requires a null terminated string, so presumably we were hitting junk after the initial path that sometimes turned it into an absolute path. From the Windows docs:

A pointer to a null-terminated string of maximum length MAX_PATH that
contains the path to search.

Fixes #2360
Resolves rdar://165006835

@bnbarham
Copy link
Contributor Author

@swift-ci please test

Copy link
Member

@ahoppen ahoppen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch.

@bnbarham
Copy link
Contributor Author

@swift-ci please test

@ahoppen
Copy link
Member

ahoppen commented Nov 19, 2025

@swift-ci Please test Windows

@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows

1 similar comment
@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows

`CompilationDatabaseTests` have been flakey on Windows since
swiftlang#2334. This didn't really
introduce the failure though - it just added tests that now catch it.

The underlying cause is that `filename.isAbsolutePath` sometimes returns
`true` for a relative path, which then causes the CWD to be prepended
instead of the given `compileCommandsDirectory`.

`PathIsRelativeW` requires a null terminated string, so presumably we
were hitting junk after the initial path that sometimes turned it into
an absolute path. From the Windows docs:
> A pointer to a null-terminated string of maximum length MAX_PATH that
contains the path to search.

Fixes swiftlang#2360
Resolves rdar://165006835
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows

1 similar comment
@bnbarham
Copy link
Contributor Author

@swift-ci please test Windows

@bnbarham bnbarham enabled auto-merge November 20, 2025 22:19
@bnbarham bnbarham disabled auto-merge November 20, 2025 22:19
@bnbarham bnbarham enabled auto-merge November 20, 2025 22:19
@bnbarham bnbarham merged commit c1414a7 into swiftlang:main Nov 21, 2025
3 checks passed
@bnbarham bnbarham deleted the flakey-compdb branch November 21, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows CI unstable with SourceKitLSPTests

3 participants