diff --git a/go.mod b/go.mod index 6db223a6f..828bc017c 100644 --- a/go.mod +++ b/go.mod @@ -31,7 +31,7 @@ require ( codeberg.org/gruf/go-debug v1.3.0 codeberg.org/gruf/go-errors/v2 v2.3.2 codeberg.org/gruf/go-fastcopy v1.1.3 - codeberg.org/gruf/go-ffmpreg v0.6.4 + codeberg.org/gruf/go-ffmpreg v0.6.5 codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf codeberg.org/gruf/go-kv v1.6.5 codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f @@ -62,7 +62,7 @@ require ( github.com/miekg/dns v1.1.62 github.com/minio/minio-go/v7 v7.0.81 github.com/mitchellh/mapstructure v1.5.0 - github.com/ncruces/go-sqlite3 v0.21.3 + github.com/ncruces/go-sqlite3 v0.22.0 github.com/oklog/ulid v1.3.1 github.com/prometheus/client_golang v1.20.5 github.com/spf13/cobra v1.8.1 @@ -91,7 +91,7 @@ require ( go.opentelemetry.io/otel/sdk/metric v1.32.0 go.opentelemetry.io/otel/trace v1.33.0 go.uber.org/automaxprocs v1.6.0 - golang.org/x/crypto v0.31.0 + golang.org/x/crypto v0.32.0 golang.org/x/image v0.23.0 golang.org/x/net v0.33.0 golang.org/x/oauth2 v0.24.0 diff --git a/go.sum b/go.sum index 19b82fadb..5b8c90746 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ codeberg.org/gruf/go-fastcopy v1.1.3 h1:Jo9VTQjI6KYimlw25PPc7YLA3Xm+XMQhaHwKnM7x codeberg.org/gruf/go-fastcopy v1.1.3/go.mod h1:GDDYR0Cnb3U/AIfGM3983V/L+GN+vuwVMvrmVABo21s= codeberg.org/gruf/go-fastpath/v2 v2.0.0 h1:iAS9GZahFhyWEH0KLhFEJR+txx1ZhMXxYzu2q5Qo9c0= codeberg.org/gruf/go-fastpath/v2 v2.0.0/go.mod h1:3pPqu5nZjpbRrOqvLyAK7puS1OfEtQvjd6342Cwz56Q= -codeberg.org/gruf/go-ffmpreg v0.6.4 h1:TaTx3SW1+PhJXgr1LUZF+/LHWg/8Oe8cDLJyMOsIPb8= -codeberg.org/gruf/go-ffmpreg v0.6.4/go.mod h1:HQmEaBF83rHOt2Jo1yJv9D0JApoSLFtVR9Uzu7aVglk= +codeberg.org/gruf/go-ffmpreg v0.6.5 h1:Ai7UnFfBFyz65m54/OlhCs++cFnepS4X++oV5VtyeQU= +codeberg.org/gruf/go-ffmpreg v0.6.5/go.mod h1:HQmEaBF83rHOt2Jo1yJv9D0JApoSLFtVR9Uzu7aVglk= codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf h1:84s/ii8N6lYlskZjHH+DG6jyia8w2mXMZlRwFn8Gs3A= codeberg.org/gruf/go-iotools v0.0.0-20240710125620-934ae9c654cf/go.mod h1:zZAICsp5rY7+hxnws2V0ePrWxE0Z2Z/KXcN3p/RQCfk= codeberg.org/gruf/go-kv v1.6.5 h1:ttPf0NA8F79pDqBttSudPTVCZmGncumeNIxmeM9ztz0= @@ -431,8 +431,8 @@ github.com/moul/http2curl v1.0.0 h1:dRMWoAtb+ePxMlLkrCbAqh4TlPHXvoGUSQ323/9Zahs= github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/ncruces/go-sqlite3 v0.21.3 h1:hHkfNQLcbnxPJZhC/RGw9SwP3bfkv/Y0xUHWsr1CdMQ= -github.com/ncruces/go-sqlite3 v0.21.3/go.mod h1:zxMOaSG5kFYVFK4xQa0pdwIszqxqJ0W0BxBgwdrNjuA= +github.com/ncruces/go-sqlite3 v0.22.0 h1:FkGSBhd0TY6e66k1LVhyEpA+RnG/8QkQNed5pjIk4cs= +github.com/ncruces/go-sqlite3 v0.22.0/go.mod h1:ueXOZXYZS2OFQirCU3mHneDwJm5fGKHrtccYBeGEV7M= github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4= github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls= github.com/ncruces/julianday v1.0.0 h1:fH0OKwa7NWvniGQtxdJRxAgkBMolni2BjDHaWTxqt7M= @@ -666,8 +666,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= -golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -802,8 +802,8 @@ golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= -golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/vendor/codeberg.org/gruf/go-ffmpreg/embed/ffmpreg.wasm.gz b/vendor/codeberg.org/gruf/go-ffmpreg/embed/ffmpreg.wasm.gz index 116fcf802..080e1aeca 100644 Binary files a/vendor/codeberg.org/gruf/go-ffmpreg/embed/ffmpreg.wasm.gz and b/vendor/codeberg.org/gruf/go-ffmpreg/embed/ffmpreg.wasm.gz differ diff --git a/vendor/github.com/ncruces/go-sqlite3/README.md b/vendor/github.com/ncruces/go-sqlite3/README.md index b370e9638..7591f3cb3 100644 --- a/vendor/github.com/ncruces/go-sqlite3/README.md +++ b/vendor/github.com/ncruces/go-sqlite3/README.md @@ -76,7 +76,7 @@ It also benefits greatly from [SQLite's](https://sqlite.org/testing.html) and Every commit is [tested](https://github.com/ncruces/go-sqlite3/wiki/Support-matrix) on Linux (amd64/arm64/386/riscv64/ppc64le/s390x), macOS (amd64/arm64), -Windows (amd64), FreeBSD (amd64), OpenBSD (amd64), NetBSD (amd64), +Windows (amd64), FreeBSD (amd64/arm64), OpenBSD (amd64), NetBSD (amd64/arm64), DragonFly BSD (amd64), illumos (amd64), and Solaris (amd64). The Go VFS is tested by running SQLite's diff --git a/vendor/github.com/ncruces/go-sqlite3/conn.go b/vendor/github.com/ncruces/go-sqlite3/conn.go index d1ce30556..862d43061 100644 --- a/vendor/github.com/ncruces/go-sqlite3/conn.go +++ b/vendor/github.com/ncruces/go-sqlite3/conn.go @@ -6,6 +6,7 @@ "math" "math/rand" "net/url" + "runtime" "strings" "time" @@ -67,7 +68,7 @@ func OpenFlags(filename string, flags OpenFlag) (*Conn, error) { return newConn(context.Background(), filename, flags) } -type connKey struct{} +type connKey = util.ConnKey func newConn(ctx context.Context, filename string, flags OpenFlag) (res *Conn, _ error) { err := ctx.Err() @@ -375,8 +376,13 @@ func (c *Conn) checkInterrupt(handle uint32) { } func progressCallback(ctx context.Context, mod api.Module, _ uint32) (interrupt uint32) { - if c, ok := ctx.Value(connKey{}).(*Conn); ok && c.interrupt.Err() != nil { - interrupt = 1 + if c, ok := ctx.Value(connKey{}).(*Conn); ok { + if c.interrupt.Done() != nil { + runtime.Gosched() + } + if c.interrupt.Err() != nil { + interrupt = 1 + } } return interrupt } diff --git a/vendor/github.com/ncruces/go-sqlite3/const.go b/vendor/github.com/ncruces/go-sqlite3/const.go index 3a6a8cdb9..d4908de00 100644 --- a/vendor/github.com/ncruces/go-sqlite3/const.go +++ b/vendor/github.com/ncruces/go-sqlite3/const.go @@ -166,6 +166,7 @@ PREPARE_PERSISTENT PrepareFlag = 0x01 PREPARE_NORMALIZE PrepareFlag = 0x02 PREPARE_NO_VTAB PrepareFlag = 0x04 + PREPARE_DONT_LOG PrepareFlag = 0x10 ) // FunctionFlag is a flag that can be passed to @@ -219,6 +220,7 @@ DBSTATUS_DEFERRED_FKS DBStatus = 10 DBSTATUS_CACHE_USED_SHARED DBStatus = 11 DBSTATUS_CACHE_SPILL DBStatus = 12 + // DBSTATUS_MAX DBStatus = 12 ) // DBConfig are the available database connection configuration options. diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/README.md b/vendor/github.com/ncruces/go-sqlite3/embed/README.md index edec63320..ca5108c8c 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/README.md +++ b/vendor/github.com/ncruces/go-sqlite3/embed/README.md @@ -1,6 +1,6 @@ # Embeddable Wasm build of SQLite -This folder includes an embeddable Wasm build of SQLite 3.47.2 for use with +This folder includes an embeddable Wasm build of SQLite 3.48.0 for use with [`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3). The following optional features are compiled in: diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh index ed2aaec53..a6b21d366 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/build.sh +++ b/vendor/github.com/ncruces/go-sqlite3/embed/build.sh @@ -14,7 +14,7 @@ trap 'rm -f sqlite3.tmp' EXIT -o sqlite3.wasm "$ROOT/sqlite3/main.c" \ -I"$ROOT/sqlite3" \ -mexec-model=reactor \ - -matomics -msimd128 -mmutable-globals -mmultivalue \ + -msimd128 -mmutable-globals -mmultivalue \ -mbulk-memory -mreference-types \ -mnontrapping-fptoint -msign-ext \ -fno-stack-protector -fno-stack-clash-protection \ diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt index 546019552..597c79547 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt +++ b/vendor/github.com/ncruces/go-sqlite3/embed/exports.txt @@ -77,6 +77,7 @@ sqlite3_get_autocommit sqlite3_get_auxdata sqlite3_hard_heap_limit64 sqlite3_interrupt +sqlite3_invoke_busy_handler_go sqlite3_last_insert_rowid sqlite3_limit sqlite3_malloc64 diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/init.go b/vendor/github.com/ncruces/go-sqlite3/embed/init.go index da527abd0..5ffd69516 100644 --- a/vendor/github.com/ncruces/go-sqlite3/embed/init.go +++ b/vendor/github.com/ncruces/go-sqlite3/embed/init.go @@ -8,13 +8,14 @@ import ( _ "embed" + "unsafe" "github.com/ncruces/go-sqlite3" ) //go:embed sqlite3.wasm -var binary []byte +var binary string func init() { - sqlite3.Binary = binary + sqlite3.Binary = unsafe.Slice(unsafe.StringData(binary), len(binary)) } diff --git a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm index c312aa62a..1d274557a 100644 Binary files a/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm and b/vendor/github.com/ncruces/go-sqlite3/embed/sqlite3.wasm differ diff --git a/vendor/github.com/ncruces/go-sqlite3/go.work.sum b/vendor/github.com/ncruces/go-sqlite3/go.work.sum index ded9bda72..224b04377 100644 --- a/vendor/github.com/ncruces/go-sqlite3/go.work.sum +++ b/vendor/github.com/ncruces/go-sqlite3/go.work.sum @@ -12,5 +12,6 @@ golang.org/x/term v0.24.0/go.mod h1:lOBK/LVxemqiMij05LGJ0tzNr8xlmwBRJ81PX6wVLH8= golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/compiler.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/compiler.go new file mode 100644 index 000000000..aeefcced9 --- /dev/null +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/compiler.go @@ -0,0 +1,27 @@ +package util + +import ( + "runtime" + + "golang.org/x/sys/cpu" +) + +func CompilerSupported() bool { + switch runtime.GOOS { + case "linux", "android", + "windows", "darwin", + "freebsd", "netbsd", "dragonfly", + "solaris", "illumos": + break + default: + return false + } + switch runtime.GOARCH { + case "amd64": + return cpu.X86.HasSSE41 + case "arm64": + return true + default: + return false + } +} diff --git a/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go b/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go index 4089dcab9..ba5754a32 100644 --- a/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go +++ b/vendor/github.com/ncruces/go-sqlite3/internal/util/module.go @@ -8,6 +8,8 @@ "github.com/ncruces/go-sqlite3/internal/alloc" ) +type ConnKey struct{} + type moduleKey struct{} type moduleState struct { mmapState diff --git a/vendor/github.com/ncruces/go-sqlite3/sqlite.go b/vendor/github.com/ncruces/go-sqlite3/sqlite.go index 18a2c2a73..18f8241df 100644 --- a/vendor/github.com/ncruces/go-sqlite3/sqlite.go +++ b/vendor/github.com/ncruces/go-sqlite3/sqlite.go @@ -11,7 +11,6 @@ "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" - "github.com/tetratelabs/wazero/experimental" "github.com/ncruces/go-sqlite3/internal/util" "github.com/ncruces/go-sqlite3/vfs" @@ -49,14 +48,18 @@ func compileSQLite() { ctx := context.Background() cfg := RuntimeConfig if cfg == nil { - cfg = wazero.NewRuntimeConfig() - if bits.UintSize >= 64 { - cfg = cfg.WithMemoryLimitPages(4096) // 256MB + if util.CompilerSupported() { + cfg = wazero.NewRuntimeConfigCompiler() } else { + cfg = wazero.NewRuntimeConfigInterpreter() + } + if bits.UintSize < 64 { cfg = cfg.WithMemoryLimitPages(512) // 32MB + } else { + cfg = cfg.WithMemoryLimitPages(4096) // 256MB } } - cfg = cfg.WithCoreFeatures(api.CoreFeaturesV2 | experimental.CoreFeaturesThreads) + cfg = cfg.WithCoreFeatures(api.CoreFeaturesV2) instance.runtime = wazero.NewRuntimeWithConfig(ctx, cfg) diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse.go b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse.go index 7326f7dbb..f84fc4dd1 100644 --- a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse.go +++ b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse.go @@ -17,7 +17,7 @@ ) var ( - //go:embed parse/sql3parse_table.wasm + //go:embed wasm/sql3parse_table.wasm binary []byte once sync.Once runtime wazero.Runtime diff --git a/vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse/sql3parse_table.wasm b/vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm similarity index 100% rename from vendor/github.com/ncruces/go-sqlite3/util/sql3util/parse/sql3parse_table.wasm rename to vendor/github.com/ncruces/go-sqlite3/util/sql3util/wasm/sql3parse_table.wasm diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/api.go b/vendor/github.com/ncruces/go-sqlite3/vfs/api.go index 330e8a2b1..f2531f223 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/api.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/api.go @@ -65,14 +65,14 @@ type FileLockState interface { LockState() LockLevel } -// FilePersistentWAL extends File to implement the +// FilePersistWAL extends File to implement the // SQLITE_FCNTL_PERSIST_WAL file control opcode. // // https://sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpersistwal -type FilePersistentWAL interface { +type FilePersistWAL interface { File - PersistentWAL() bool - SetPersistentWAL(bool) + PersistWAL() bool + SetPersistWAL(bool) } // FilePowersafeOverwrite extends File to implement the @@ -121,6 +121,15 @@ type FileOverwrite interface { Overwrite() error } +// FileSync extends File to implement the +// SQLITE_FCNTL_SYNC file control opcode. +// +// https://sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlsync +type FileSync interface { + File + SyncSuper(super string) error +} + // FileCommitPhaseTwo extends File to implement the // SQLITE_FCNTL_COMMIT_PHASETWO file control opcode. // @@ -162,6 +171,15 @@ type FilePragma interface { Pragma(name, value string) (string, error) } +// FileBusyHandler extends File to implement the +// SQLITE_FCNTL_BUSYHANDLER file control opcode. +// +// https://sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlbusyhandler +type FileBusyHandler interface { + File + BusyHandler(func() bool) +} + // FileSharedMemory extends File to possibly implement // shared-memory for the WAL-index. // The same shared-memory instance must be returned @@ -191,3 +209,8 @@ type fileControl interface { File fileControl(ctx context.Context, mod api.Module, op _FcntlOpcode, pArg uint32) _ErrorCode } + +type filePDB interface { + File + SetDB(any) +} diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/const.go b/vendor/github.com/ncruces/go-sqlite3/vfs/const.go index 896cdaca4..1c9b77a7a 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/const.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/const.go @@ -225,6 +225,7 @@ func (e _ErrorCode) Error() string { _FCNTL_EXTERNAL_READER _FcntlOpcode = 40 _FCNTL_CKSM_FILE _FcntlOpcode = 41 _FCNTL_RESET_CACHE _FcntlOpcode = 42 + _FCNTL_NULL_IO _FcntlOpcode = 43 ) // https://sqlite.org/c3ref/c_shm_exclusive.html diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go index b5d285375..e028a2a55 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go @@ -6,7 +6,6 @@ "io/fs" "os" "path/filepath" - "runtime" "syscall" "github.com/ncruces/go-sqlite3/util/osutil" @@ -41,7 +40,7 @@ func (vfsOS) Delete(path string, syncDir bool) error { if err != nil { return err } - if runtime.GOOS != "windows" && syncDir { + if canSyncDirs && syncDir { f, err := os.Open(filepath.Dir(path)) if err != nil { return _OK @@ -120,9 +119,9 @@ func (vfsOS) OpenFilename(name *Filename, flags OpenFlag) (File, OpenFlag, error File: f, psow: true, readOnly: flags&OPEN_READONLY != 0, - syncDir: runtime.GOOS != "windows" && - flags&(OPEN_CREATE) != 0 && - flags&(OPEN_MAIN_JOURNAL|OPEN_SUPER_JOURNAL|OPEN_WAL) != 0, + syncDir: canSyncDirs && + flags&(OPEN_MAIN_JOURNAL|OPEN_SUPER_JOURNAL|OPEN_WAL) != 0 && + flags&(OPEN_CREATE) != 0, shm: NewSharedMemory(name.String()+"-shm", flags), } return &file, flags, nil @@ -143,7 +142,7 @@ type vfsFile struct { _ FileLockState = &vfsFile{} _ FileHasMoved = &vfsFile{} _ FileSizeHint = &vfsFile{} - _ FilePersistentWAL = &vfsFile{} + _ FilePersistWAL = &vfsFile{} _ FilePowersafeOverwrite = &vfsFile{} ) @@ -163,7 +162,7 @@ func (f *vfsFile) Sync(flags SyncFlag) error { if err != nil { return err } - if runtime.GOOS != "windows" && f.syncDir { + if canSyncDirs && f.syncDir { f.syncDir = false d, err := os.Open(filepath.Dir(f.File.Name())) if err != nil { @@ -218,6 +217,6 @@ func (f *vfsFile) HasMoved() (bool, error) { func (f *vfsFile) LockState() LockLevel { return f.lock } func (f *vfsFile) PowersafeOverwrite() bool { return f.psow } -func (f *vfsFile) PersistentWAL() bool { return f.keepWAL } +func (f *vfsFile) PersistWAL() bool { return f.keepWAL } func (f *vfsFile) SetPowersafeOverwrite(psow bool) { f.psow = psow } -func (f *vfsFile) SetPersistentWAL(keepWAL bool) { f.keepWAL = keepWAL } +func (f *vfsFile) SetPersistWAL(keepWAL bool) { f.keepWAL = keepWAL } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go index 686f8e9a7..4adb2dde2 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/memdb.go @@ -62,11 +62,11 @@ func (memVFS) Open(name string, flags vfs.OpenFlag) (vfs.File, vfs.OpenFlag, err } func (memVFS) Delete(name string, dirSync bool) error { - return sqlite3.IOERR_DELETE + return sqlite3.IOERR_DELETE_NOENT // used to delete journals } func (memVFS) Access(name string, flag vfs.AccessFlag) (bool, error) { - return false, nil + return false, nil // used to check for journals } func (memVFS) FullPathname(name string) (string, error) { diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go index a17893d2e..0d0ca24c9 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go @@ -7,7 +7,10 @@ "os" ) -const _O_NOFOLLOW = 0 +const ( + _O_NOFOLLOW = 0 + canSyncDirs = false +) func osAccess(path string, flags AccessFlag) error { fi, err := os.Stat(path) diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go index 6637c2922..c4f9ba870 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go @@ -9,7 +9,10 @@ "golang.org/x/sys/unix" ) -const _O_NOFOLLOW = unix.O_NOFOLLOW +const ( + _O_NOFOLLOW = unix.O_NOFOLLOW + canSyncDirs = true +) func osAccess(path string, flags AccessFlag) error { var access uint32 // unix.F_OK diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go index 5f4f5d108..76e6888e1 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/shm_bsd.go @@ -178,7 +178,7 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode { s.Lock() defer s.Unlock() - // Check if we could obtain/release the lock locally. + // Check if we can obtain/release locks locally. rc := s.shmMemLock(offset, n, flags) if rc != _OK { return rc @@ -187,6 +187,8 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode { // Obtain/release the appropriate file locks. switch { case flags&_SHM_UNLOCK != 0: + // Relasing a shared lock decrements the counter, + // but may leave parts of the range still locked. begin, end := offset, offset+n for i := begin; i < end; i++ { if s.vfsShmParent.lock[i] != 0 { @@ -201,14 +203,22 @@ func (s *vfsShm) shmLock(offset, n int32, flags _ShmFlag) _ErrorCode { } return rc case flags&_SHM_SHARED != 0: - rc = osReadLock(s.File, _SHM_BASE+int64(offset), int64(n)) + // Acquiring a new shared lock on the file is only necessary + // if there was a new shared lock in the range. + for i := offset; i < offset+n; i++ { + if s.vfsShmParent.lock[i] == 1 { + rc = osReadLock(s.File, _SHM_BASE+int64(offset), int64(n)) + break + } + } case flags&_SHM_EXCLUSIVE != 0: + // Acquiring an exclusive lock on the file is always necessary. rc = osWriteLock(s.File, _SHM_BASE+int64(offset), int64(n)) default: panic(util.AssertErr()) } - // Release the local lock we had acquired. + // Release the local locks we had acquired. if rc != _OK { s.shmMemLock(offset, n, flags^(_SHM_UNLOCK|_SHM_LOCK)) } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go b/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go index 83c95d08d..d8816e409 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/vfs.go @@ -255,10 +255,10 @@ func vfsFileControlImpl(ctx context.Context, mod api.Module, file File, op _Fcnt } case _FCNTL_PERSIST_WAL: - if file, ok := file.(FilePersistentWAL); ok { + if file, ok := file.(FilePersistWAL); ok { if i := util.ReadUint32(mod, pArg); int32(i) >= 0 { - file.SetPersistentWAL(i != 0) - } else if file.PersistentWAL() { + file.SetPersistWAL(i != 0) + } else if file.PersistWAL() { util.WriteUint32(mod, pArg, 1) } else { util.WriteUint32(mod, pArg, 0) @@ -309,6 +309,16 @@ func vfsFileControlImpl(ctx context.Context, mod api.Module, file File, op _Fcnt return vfsErrorCode(err, _IOERR) } + case _FCNTL_SYNC: + if file, ok := file.(FileSync); ok { + var name string + if pArg != 0 { + name = util.ReadString(mod, pArg, _MAX_PATHNAME) + } + err := file.SyncSuper(name) + return vfsErrorCode(err, _IOERR) + } + case _FCNTL_COMMIT_PHASETWO: if file, ok := file.(FileCommitPhaseTwo); ok { err := file.CommitPhaseTwo() @@ -369,6 +379,20 @@ func vfsFileControlImpl(ctx context.Context, mod api.Module, file File, op _Fcnt return ret } + case _FCNTL_BUSYHANDLER: + if file, ok := file.(FileBusyHandler); ok { + arg := util.ReadUint64(mod, pArg) + fn := mod.ExportedFunction("sqlite3_invoke_busy_handler_go") + file.BusyHandler(func() bool { + stack := [...]uint64{arg} + if err := fn.CallWithStack(ctx, stack[:]); err != nil { + panic(err) + } + return uint32(stack[0]) != 0 + }) + return _OK + } + case _FCNTL_LOCK_TIMEOUT: if file, ok := file.(FileSharedMemory); ok { if shm, ok := file.SharedMemory().(blockingSharedMemory); ok { @@ -376,12 +400,14 @@ func vfsFileControlImpl(ctx context.Context, mod api.Module, file File, op _Fcnt return _OK } } + + case _FCNTL_PDB: + if file, ok := file.(filePDB); ok { + file.SetDB(ctx.Value(util.ConnKey{})) + return _OK + } } - // Consider also implementing these opcodes (in use by SQLite): - // _FCNTL_BUSYHANDLER - // _FCNTL_LAST_ERRNO - // _FCNTL_SYNC return _NOTFOUND } diff --git a/vendor/github.com/ncruces/go-sqlite3/vtab.go b/vendor/github.com/ncruces/go-sqlite3/vtab.go index 983486230..1998a5281 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vtab.go +++ b/vendor/github.com/ncruces/go-sqlite3/vtab.go @@ -242,7 +242,7 @@ type VTabSavepointer interface { // A VTabCursor may optionally implement // [io.Closer] to free resources. // -// http://sqlite.org/c3ref/vtab_cursor.html +// https://sqlite.org/c3ref/vtab_cursor.html type VTabCursor interface { // https://sqlite.org/vtab.html#xfilter Filter(idxNum int, idxStr string, arg ...Value) error diff --git a/vendor/golang.org/x/crypto/acme/types.go b/vendor/golang.org/x/crypto/acme/types.go index 4888726fe..23a4d6517 100644 --- a/vendor/golang.org/x/crypto/acme/types.go +++ b/vendor/golang.org/x/crypto/acme/types.go @@ -288,7 +288,7 @@ type Directory struct { // KeyChangeURL allows to perform account key rollover flow. KeyChangeURL string - // Term is a URI identifying the current terms of service. + // Terms is a URI identifying the current terms of service. Terms string // Website is an HTTP or HTTPS URL locating a website diff --git a/vendor/modules.txt b/vendor/modules.txt index be0ee4cb6..539911182 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -24,7 +24,7 @@ codeberg.org/gruf/go-fastcopy # codeberg.org/gruf/go-fastpath/v2 v2.0.0 ## explicit; go 1.14 codeberg.org/gruf/go-fastpath/v2 -# codeberg.org/gruf/go-ffmpreg v0.6.4 +# codeberg.org/gruf/go-ffmpreg v0.6.5 ## explicit; go 1.22.0 codeberg.org/gruf/go-ffmpreg/embed codeberg.org/gruf/go-ffmpreg/wasm @@ -526,7 +526,7 @@ github.com/modern-go/reflect2 # github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 ## explicit github.com/munnerz/goautoneg -# github.com/ncruces/go-sqlite3 v0.21.3 +# github.com/ncruces/go-sqlite3 v0.22.0 ## explicit; go 1.21 github.com/ncruces/go-sqlite3 github.com/ncruces/go-sqlite3/driver @@ -1074,7 +1074,7 @@ go.uber.org/multierr # golang.org/x/arch v0.12.0 ## explicit; go 1.18 golang.org/x/arch/x86/x86asm -# golang.org/x/crypto v0.31.0 +# golang.org/x/crypto v0.32.0 ## explicit; go 1.20 golang.org/x/crypto/acme golang.org/x/crypto/acme/autocert