Reduce unsafe code in SQLite
I maintainer di solito rispondono entro 3 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 22/100
Direzione di ricerca
This is a project-wide audit of unsafe in the SQLite backend, not a single-file edit. Search sqlite-related modules for unsafe blocks, shrink each to the individual FFI calls, and add SAFETY comments for the invariants. Mark helpers unsafe when they cannot check those invariants and document them for callers. No files or tests are named; start from the crate’s SQLite sources. Done means tighter blocks plus comments, possibly some public APIs marked unsafe. The issue is 330 days old with no comments, so check with maintainers before a large PR.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I have found these related issues/pull requests
No related issues.
Description
SQLx advertises not using any unsafe code, except for SQLite. This is great, however where unsafe code is used, it often wraps the whole function, not just the individual function calls that require the unsafe block. This makes it harder to see where SAFETY comments are needed.
There's about 100 unsafe blocks at the moment, many of which contain multiple unsafe calls, and there are only 36 SAFETY comments.
For a project that advertises itself on not using unsafe code where it doesn't need to, this is surprising.
I also suspect there are cases of functions that assume invariants in their parameters that go unchecked, and as such should be marked as unsafe, but haven't been.
Prefered solution
Put unsafe blocks only around individual unsafe function calls.
Add SAFETY comments to function calls detailing the invariants the function expects, and why they are met.
If the function cannot guarantee that they are met it should be marked as unsafe, have it's invariants documented, and have SAFETY comments added to the callers explaining how they uphold the invariants.
I don't have time to do this myself at the moment, and I know you don't have the time either, so this probably isn't getting done any time soon. But I still think it's a problem that deserves an issue.
Is this a breaking change? Why or why not?
There may be some public APIs that have to be made unsafe, but most of the code this effects is internal
- Lingua principale
- Rust
- Stelle
- 17.5k
- Fork
- 1.7k
- Merge medio
- 1g 17h
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di transact-rs/sqlx
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
transact-rs/sqlx#4466 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4453 ·
I maintainer di solito rispondono entro 3 giorni
-
Postgres text arrays: a quoted "NULL" element is decoded as SQL NULLForse già presa @MinJaeRun l’ha presa 11 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4452 ·
I maintainer di solito rispondono entro 3 giorni
-
Fetch stream ends after first error using query macrosForse già presa @barry3406 l’ha presa 211 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
transact-rs/sqlx#4126 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
transact-rs/sqlx#3963 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di transact-rs/sqlx
Issue simili
-
area:frontend kind:bug priority:p2 ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
storytold/vectorcraft#6143 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
rubys/roundhouse#1917 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno