Repository navigation
Conversation
iyi 0.21.0 refuses an operation on raw memory in a module that is not
marked @[Unsafe("why")] above its module header (SPEC.md III.13), and
0.20.x refuses the mark. sqlite/core, which calls libsqlite3, is marked,
saying what it does with the memory. sqlite/dates reads a time's text
with byte_at instead, so the compiler checks it.
0.21.0 proves a @[SafeReach] claim instead of trusting it, and handing
REGEXP_FN to sqlite3_create_function is beyond the proof, so it is
@[UnsafeReach], taken on trust in a marked module (III.4.4).
A plain spawn whose block captures only Share values runs in parallel on
0.21.0 (III.4.15), so pool_test's five writers hit "database is locked"
with no busy_timeout; they stay in the test's unit with
spawn(unit: :same), as crystal-sqlite3's fibers shared one thread.
iyi-db 0.4.0 is refused by 0.21.0 too, so iyi.mod requires 0.5.0, the
release that carries its marks; iyi.sum is from
`iyi get github.com/iyilang/db@v0.5.0`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
iyi 0.21.0 refuses an operation on raw memory in a module that doesn't say it handles some (SPEC.md III.13). A module says so with one
@[Unsafe("why")]above itsmoduleheader, a mark 0.20.x refuses. 0.21.0 also adds safe calls for the common cases:String#byte_at,Bytes.ofandString.new(Array(UInt8)). iyi-db v0.4.0 is refused by 0.21.0 too; v0.5.0 carries its marks.On 0.21.0, master is refused in
sqlite/core(the libsqlite3 binding) andsqlite/dates(text.to_unsafe), so every test fails to build.This PR:
sqlite/core, the module that calls libsqlite3: "calls libsqlite3 through its C binding with the connection and statement handles it answers, passing text and blobs by pointer and copying the text and blobs it answers out of the library's memory".sqlite/datesparses a time's text withbyte_atinstead of indexingto_unsafe, so the compiler checks every index.REGEXP_FNis@[UnsafeReach]instead of@[SafeReach]. 0.21.0 proves aSafeReachclaim (SPEC.md III.4.4), and refused this one: handing the proc tosqlite3_create_functioncounts as a write it cannot place.UnsafeReachkeeps the claim on trust, and is allowed in a module marked@[Unsafe].pool_test's writers usespawn(unit: :same). 0.21.0 runs a plain spawn in parallel when its block captures onlySharevalues (III.4.15), and aDatabaseisShare, so the five writers ran at once and SQLite answered "database is locked" (nobusy_timeout). crystal-sqlite3's fibers shared one thread, whichunit: :samekeeps.IYI_VERSIONand README Requirements,iyi.modrequiringgithub.com/iyilang/db v0.5.0(iyi.sumfromiyi get github.com/iyilang/db@v0.5.0), and a CHANGELOGUnreleasedentry.No
spawn_parallel/spawn_serial/parallel:/serial:spellings were in the repository.Tests (iyi 0.21.0 release binary, Linux x86_64)
The
iyi-0.21.0-linux-x86_64.tar.gzfrom the v0.21.0 release, against the system's libsqlite3, CI's steps:iyi test sqlite: 6 passed, 0 failed, three runs. Before thepool_testchange it was 5 passed, 1 failed ("database is locked").examples/memory.iyibuilds and runs.iyi fmt --check sqlite.iyi sqlite examplespasses;iyi checkofsqlite.iyiand the example prints nothing.