Skip to content

Conversation

@BCSharp
Copy link
Member

@BCSharp BCSharp commented Apr 3, 2025

The file locking strategy in SQLite was basically Windows-oriented, with some provisions for limited-trust environment like Silverlight, WinRT, and Windows Mobile. These are obsolete but somebody repurposed the limited-trust strategy to work on Unix. This worked on Linux (sort of, shared locks were seemingly emulated in a way that only SQLite respected), but wasn't working at all on macOS.

This PR implements proper locking on Linux and macOS through a fcntl syscall via Mono.Unix. Locking on Windows is unchanged.

I resisted the temptation to start cleaning up the code (it is even badly formatted), because there would be no end to it, and it is better to replace it by a modern SQLite implementation in a longer run anyway.

Copy link
Contributor

@slozier slozier left a comment

Choose a reason for hiding this comment

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

LGTM!

it is better to replace it by a modern SQLite implementation in a longer run anyway.

I agree trying to maintain this is not a good long term solution. Although I do like having a purely managed implementation...

@BCSharp BCSharp merged commit 9d6fa23 into IronLanguages:main Apr 4, 2025
17 checks passed
@BCSharp BCSharp deleted the sqlite_locking branch April 4, 2025 22:07
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.

2 participants