Commit 2e433240 authored by cznic's avatar cznic
Browse files

lib: re-vendor from modernc.org/libsqlite3 v1.15.0 (SEH emulation), pin libc v1.77.1, Go 1.26

- lib/: `make vendor` from ../libsqlite3 at v1.15.0 (879cf166). SQLite stays
  3.53.4. Every target now calls _modernc_seh_try (1 site) and
  _modernc_seh_inject (17 sites), defined in the hand-written lib/seh.go, so a
  fault on the memory-mapped -shm file fails the statement with
  SQLITE_IOERR_IN_PAGE instead of crashing the process (#221). vec/ is
  unchanged: ../libsqlite_vec is still at v0.5.0.
- The lib constants are evaluated as C expressions now (cc v4.29.4): on
  linux/amd64 42 change value (WALINDEX_PGSZ is 32768, not 0;
  HASHTABLE_NPAGE_ONE 4062, ROWSET_ENTRY_PER_CHUNK 42), 33 appear and nine
  that never had a meaningful value are gone (INFINITY, MB_CUR_MAX, NAN,
  RESERVED_BYTE, SHARED_FIRST, SQLITE_CANTOPEN_BKPT, SQLITE_CORRUPT_BKPT,
  SQLITE_DEFAULT_LOOKASIDE, SQLITE_MISUSE_BKPT).
- vendor_libs/main.go: skip SQLITE_STATIC like SQLITE_TRANSIENT; both are
  typed constants in lib/defs.go and the transpile now emits SQLITE_STATIC.
- go.mod: modernc.org/libc v1.77.1, golang.org/x/sys v0.48.0, go 1.26.0;
  `make sbom` regenerated the four license/SBOM documents.
- CHANGELOG.md: two bullets in the pending section.

Verified on linux/amd64: make vendor (build_all_targets included), make
editor, go vet ./lib (no duplicate declarations), go test -run TestSEH,
go test . ./vec/... ./vfs/... ./pcache/...

Co-Authored-By: default avatarClaude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01R9XUbnEaDbcvLqQfan6Haf
parent 50380ee0
Loading
Loading
Loading
Loading
+2 −0
Changes for CHANGELOG.md: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
Entries for v1.38.1 through v1.44.1 and for v1.49.1 were added on 2026-09-05, reconstructed from the git history and the merge requests they cite; they were missing at release time.

 - 2026-09-15 v1.59.1:
     - **A fault while reading the memory-mapped `-shm` file of a WAL database no longer crashes the process.** The statement fails with a disk I/O error, extended code `SQLITE_IOERR_IN_PAGE` (8714), and the connection stays usable: SQLite's structured exception handling for WAL (`SQLITE_USE_SEH`, MSVC-only upstream) is now emulated on every platform, on by default and not switchable at run time. `lib.SehInject` and `lib.SehPending` inject such a fault for tests. Resolves [GitLab issue #221](https://gitlab.com/cznic/sqlite/-/issues/221) and supersedes [libsqlite3!4](https://gitlab.com/cznic/libsqlite3/-/merge_requests/4) and [GitHub PR #7](https://github.com/modernc-org/sqlite/pull/7), thanks hazyhaar!
     - Re-vendor `lib/` from [modernc.org/libsqlite3 v1.15.0](https://gitlab.com/cznic/libsqlite3/-/tags/v1.15.0); SQLite stays 3.53.4. **Go 1.26 is now required**, and the pinned `modernc.org/libc` becomes [v1.77.1](https://gitlab.com/cznic/libc/-/tags/v1.77.1); as always, downstream `go.mod` files must pin the same `modernc.org/libc` version this repository's `go.mod` does, see [GitLab issue #177](https://gitlab.com/cznic/sqlite/-/issues/177). The `lib` constants are now evaluated as C expressions, so some change value (`lib.WALINDEX_PGSZ` is 32768, not 0), some appear, and nine that never had a meaningful value are gone: `INFINITY`, `MB_CUR_MAX`, `NAN`, `RESERVED_BYTE`, `SHARED_FIRST`, `SQLITE_CANTOPEN_BKPT`, `SQLITE_CORRUPT_BKPT`, `SQLITE_DEFAULT_LOOKASIDE` and `SQLITE_MISUSE_BKPT`; the full list is in [libsqlite3's CHANGELOG](https://gitlab.com/cznic/libsqlite3/-/blob/master/CHANGELOG.md) under 2026-09-19.
     - **`vfs.FS.Close` now refuses while a database opened through it is still open**, returning an error that wraps the new `vfs.ErrInUse` and leaving the VFS registered. It used to free the VFS the open connection still called through, so the next query crashed the process or read through freed memory. Close the databases first, then the `FS`.
     - Fix handle reuse in `modernc.org/sqlite/vfs` on 32-bit targets: after 2^32 file opens in one process the handle counter wrapped and could overwrite a live entry, such as a file system registered at start-up, and crash. 64-bit targets were not affected.
     - **The pluggable page cache now panics when a `Cache` breaks its contract** by returning nil, or a different `Page`, from `Fetch` for a page SQLite still holds pinned. It used to free memory SQLite was still using, corrupting the database without an error. Only a `Cache` implementation with that bug is affected; `modernc.org/sqlite/pcache` is not.
+7 −7
Changes for LICENSE-3RD-PARTY.md: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -42,8 +42,8 @@ and license texts it points at are the ones you have to carry with you.
| [github.com/remyoudompheng/bigfft](https://pkg.go.dev/github.com/remyoudompheng/bigfft) | v0.0.0-20230129092748-24d4a6f8daec | BSD-3-Clause | modernc.org/fileutil, modernc.org/libc, modernc.org/mathutil, modernc.org/memory, `go.mod` | [L2](#L2) |
| [Go](https://github.com/golang/go) | -- | BSD-3-Clause | modernc.org/libc | [N1](#N1) |
| [go-netdb](https://github.com/dominikh/go-netdb) | -- | MIT | modernc.org/libc | [N1](#N1) |
| [golang.org/x/sys](https://pkg.go.dev/golang.org/x/sys) | v0.47.0 | BSD-3-Clause | github.com/google/pprof, github.com/mattn/go-isatty, modernc.org/libc, modernc.org/memory, `go.mod` | [L3](#L3) |
| [modernc.org/libc](https://pkg.go.dev/modernc.org/libc) | v1.75.7 | BSD-3-Clause | `go.mod` | [L4](#L4) |
| [golang.org/x/sys](https://pkg.go.dev/golang.org/x/sys) | v0.48.0 | BSD-3-Clause | github.com/google/pprof, github.com/mattn/go-isatty, modernc.org/libc, modernc.org/memory, `go.mod` | [L3](#L3) |
| [modernc.org/libc](https://pkg.go.dev/modernc.org/libc) | v1.77.1 | BSD-3-Clause | `go.mod` | [L4](#L4) |
| [modernc.org/mathutil](https://pkg.go.dev/modernc.org/mathutil) | v1.7.1 | BSD-3-Clause | modernc.org/fileutil, modernc.org/libc, modernc.org/memory, `go.mod` | [L4](#L4) |
| [modernc.org/memory](https://pkg.go.dev/modernc.org/memory) | v1.12.1 | BSD-3-Clause, attribution reference | modernc.org/libc, `go.mod` | [L4](#L4), [L2](#L2), [L5](#L5), [L6](#L6) |
| [musl libc](https://musl.libc.org/) | -- | MIT | modernc.org/libc | [N1](#N1) |
@@ -85,11 +85,11 @@ this one.
| [github.com/ianlancetaylor/demangle](https://pkg.go.dev/github.com/ianlancetaylor/demangle) | v0.0.0-20250417193237-f615e6bd150b | BSD-3-Clause | github.com/google/pprof | [L2](#L2) |
| [github.com/mattn/go-isatty](https://pkg.go.dev/github.com/mattn/go-isatty) | v0.0.24 | MIT | modernc.org/libc, `go.mod` | [L15](#L15) |
| [github.com/ncruces/go-strftime](https://pkg.go.dev/github.com/ncruces/go-strftime) | v1.0.0 | MIT | modernc.org/libc, `go.mod` | [L8](#L8) |
| [golang.org/x/mod](https://pkg.go.dev/golang.org/x/mod) | v0.38.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [golang.org/x/sync](https://pkg.go.dev/golang.org/x/sync) | v0.22.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [golang.org/x/tools](https://pkg.go.dev/golang.org/x/tools) | v0.48.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [modernc.org/cc/v4](https://pkg.go.dev/modernc.org/cc/v4) | v4.29.2 | BSD-3-Clause | modernc.org/libc | [L4](#L4) |
| [modernc.org/ccgo/v4](https://pkg.go.dev/modernc.org/ccgo/v4) | v4.35.0 | BSD-3-Clause | modernc.org/libc | [L4](#L4) |
| [golang.org/x/mod](https://pkg.go.dev/golang.org/x/mod) | v0.41.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [golang.org/x/sync](https://pkg.go.dev/golang.org/x/sync) | v0.23.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [golang.org/x/tools](https://pkg.go.dev/golang.org/x/tools) | v0.50.0 | BSD-3-Clause | modernc.org/libc | [L3](#L3) |
| [modernc.org/cc/v4](https://pkg.go.dev/modernc.org/cc/v4) | v4.29.7 | BSD-3-Clause | modernc.org/libc | [L4](#L4) |
| [modernc.org/ccgo/v4](https://pkg.go.dev/modernc.org/ccgo/v4) | v4.36.1 | BSD-3-Clause | modernc.org/libc | [L4](#L4) |
| [modernc.org/gc/v2](https://pkg.go.dev/modernc.org/gc/v2) | v2.6.5 | BSD-3-Clause | modernc.org/libc | [L16](#L16) |
| [modernc.org/gc/v3](https://pkg.go.dev/modernc.org/gc/v3) | v3.1.5 | BSD-3-Clause | modernc.org/libc | [L16](#L16) |
| [modernc.org/goabi0](https://pkg.go.dev/modernc.org/goabi0) | v0.2.0 | BSD-3-Clause | modernc.org/libc | [L17](#L17) |
+7 −7
Changes for SBOM.md: 7 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -64,8 +64,8 @@ embedded in both JSON documents as well.
| github.com/remyoudompheng/bigfft | v0.0.0-20230129092748-24d4a6f8daec | `BSD-3-Clause` | `pkg:golang/github.com/remyoudompheng/bigfft@v0.0.0-20230129092748-24d4a6f8daec` |
| Go | -- | `BSD-3-Clause` | -- |
| go-netdb | -- | `MIT` | -- |
| golang.org/x/sys | v0.47.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/sys@v0.47.0` |
| modernc.org/libc | v1.75.7 | `BSD-3-Clause` | `pkg:golang/modernc.org/libc@v1.75.7` |
| golang.org/x/sys | v0.48.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/sys@v0.48.0` |
| modernc.org/libc | v1.77.1 | `BSD-3-Clause` | `pkg:golang/modernc.org/libc@v1.77.1` |
| modernc.org/mathutil | v1.7.1 | `BSD-3-Clause` | `pkg:golang/modernc.org/mathutil@v1.7.1` |
| modernc.org/memory | v1.12.1 | `BSD-3-Clause AND LicenseRef-L5` | `pkg:golang/modernc.org/memory@v1.12.1` |
| musl libc | -- | `MIT` | -- |
@@ -90,11 +90,11 @@ embedded in both JSON documents as well.
| github.com/ianlancetaylor/demangle | v0.0.0-20250417193237-f615e6bd150b | `BSD-3-Clause` | `pkg:golang/github.com/ianlancetaylor/demangle@v0.0.0-20250417193237-f615e6bd150b` |
| github.com/mattn/go-isatty | v0.0.24 | `MIT` | `pkg:golang/github.com/mattn/go-isatty@v0.0.24` |
| github.com/ncruces/go-strftime | v1.0.0 | `MIT` | `pkg:golang/github.com/ncruces/go-strftime@v1.0.0` |
| golang.org/x/mod | v0.38.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/mod@v0.38.0` |
| golang.org/x/sync | v0.22.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/sync@v0.22.0` |
| golang.org/x/tools | v0.48.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/tools@v0.48.0` |
| modernc.org/cc/v4 | v4.29.2 | `BSD-3-Clause` | `pkg:golang/modernc.org/cc/v4@v4.29.2` |
| modernc.org/ccgo/v4 | v4.35.0 | `BSD-3-Clause` | `pkg:golang/modernc.org/ccgo/v4@v4.35.0` |
| golang.org/x/mod | v0.41.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/mod@v0.41.0` |
| golang.org/x/sync | v0.23.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/sync@v0.23.0` |
| golang.org/x/tools | v0.50.0 | `BSD-3-Clause` | `pkg:golang/golang.org/x/tools@v0.50.0` |
| modernc.org/cc/v4 | v4.29.7 | `BSD-3-Clause` | `pkg:golang/modernc.org/cc/v4@v4.29.7` |
| modernc.org/ccgo/v4 | v4.36.1 | `BSD-3-Clause` | `pkg:golang/modernc.org/ccgo/v4@v4.36.1` |
| modernc.org/gc/v2 | v2.6.5 | `BSD-3-Clause` | `pkg:golang/modernc.org/gc/v2@v2.6.5` |
| modernc.org/gc/v3 | v3.1.5 | `BSD-3-Clause` | `pkg:golang/modernc.org/gc/v3@v3.1.5` |
| modernc.org/goabi0 | v0.2.0 | `BSD-3-Clause` | `pkg:golang/modernc.org/goabi0@v0.2.0` |
+3 −3
Changes for go.mod: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
module modernc.org/sqlite

go 1.25.0
go 1.26.0

require (
	github.com/google/pprof v0.0.0-20260802141513-ef3492d7dac3
	golang.org/x/sys v0.47.0
	golang.org/x/sys v0.48.0
	modernc.org/fileutil v1.4.0
	modernc.org/libc v1.75.7
	modernc.org/libc v1.77.1
	modernc.org/mathutil v1.7.1
)

+14 −14
Changes for go.sum: 14 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -12,18 +12,18 @@ github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOF
github.com/ncruces/go-strftime v1.0.0/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/mod v0.38.0 h1:MECBjubtXD7yj4HrhIUcywNaGeNVUdfVnxmPajOk4yk=
golang.org/x/mod v0.38.0/go.mod h1:V6Xz0pq8TQ3dGqVQ1FVHuelZpAL0uNhSkk9ogYP3c40=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/tools v0.48.0 h1:3+hClM1aLL5mjMKm5ovokw9epgRXPuu2tILgismM6RE=
golang.org/x/tools v0.48.0/go.mod h1:08xX0orndb/F7jJxGDicx061tyd5pcMto75YMAXr6lk=
modernc.org/cc/v4 v4.29.2 h1:h6+9ciCnPKutf4I03CvheAvDLX7+IHlqR6Iy6J+cgd8=
modernc.org/cc/v4 v4.29.2/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
modernc.org/ccgo/v4 v4.35.0 h1:F+TUsmw09QxLzmi3aeYYGxjAXarmZaKgj3mKQHNaA8w=
modernc.org/ccgo/v4 v4.35.0/go.mod h1:qrVGs9S3Sr2Ztcg9ve+kTAYMp5a3YvWjo+SoN06kJ5I=
golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk=
golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU=
golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0=
modernc.org/cc/v4 v4.29.7 h1:q+NXGJ0bK3b4TXFYQQVr9pYETGnmwFWkrUzJnMya/Tg=
modernc.org/cc/v4 v4.29.7/go.mod h1:OnovgIhbbMXMu1aISnJ0wvVD1KnW+cAUJkIrAWh+kVI=
modernc.org/ccgo/v4 v4.36.1 h1:ZNIUZAryN0UgnJwtyxrdEzcFc3yD4Cu4AzjfPXsLsIE=
modernc.org/ccgo/v4 v4.36.1/go.mod h1:rrtGc2QkS239nYb/mQNuBMyjq3/y3ZXWbBjPoV3wqzA=
modernc.org/fileutil v1.4.0 h1:j6ZzNTftVS054gi281TyLjHPp6CPHr2KCxEXjEbD6SM=
modernc.org/fileutil v1.4.0/go.mod h1:EqdKFDxiByqxLk8ozOxObDSfcVOv/54xDs/DUHdvCUU=
modernc.org/gc/v2 v2.6.5 h1:nyqdV8q46KvTpZlsw66kWqwXRHdjIlJOhG6kxiV/9xI=
@@ -32,8 +32,8 @@ modernc.org/gc/v3 v3.1.5 h1:21ldfPfRYE31Tb7B3mwAK8gy1AxP4+dKjrOQPfqakoc=
modernc.org/gc/v3 v3.1.5/go.mod h1:HFK/6AGESC7Ex+EZJhJ2Gni6cTaYpSMmU/cT9RmlfYY=
modernc.org/goabi0 v0.2.0 h1:HvEowk7LxcPd0eq6mVOAEMai46V+i7Jrj13t4AzuNks=
modernc.org/goabi0 v0.2.0/go.mod h1:CEFRnnJhKvWT1c1JTI3Avm+tgOWbkOu5oPA8eH8LnMI=
modernc.org/libc v1.75.7 h1:o3DTP9/0p9pKmY2WCKQaySW6wIiZhNM7wc2lUoyhfew=
modernc.org/libc v1.75.7/go.mod h1:bO5o2ztHxBb2rjz0PgdHN0sSMw57CgxGFLZ3Qd/QpVQ=
modernc.org/libc v1.77.1 h1:Ct8j47QtiZ1Enj2DtFXQtUqrPCAjdCmPjtCuvrYQ0Hs=
modernc.org/libc v1.77.1/go.mod h1:87/pZ4L6nD1zqW4nItuS12YO7hN1igAah34xjnQo/W0=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g=
Loading