From 2c3f1f4ddb3b91c9a70b929aed51b4bffcc6d6ee Mon Sep 17 00:00:00 2001 From: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:15:09 +0000 Subject: [chore] update go-sqlite3 to v0.19.0 (#3406) --- vendor/github.com/ncruces/go-sqlite3/vfs/file.go | 19 ++++----- .../github.com/ncruces/go-sqlite3/vfs/memdb/api.go | 3 +- vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go | 47 ++++++++++++++++++++++ .../ncruces/go-sqlite3/vfs/os_std_access.go | 36 ----------------- .../ncruces/go-sqlite3/vfs/os_std_mode.go | 14 ------- .../github.com/ncruces/go-sqlite3/vfs/os_unix.go | 2 + 6 files changed, 61 insertions(+), 60 deletions(-) create mode 100644 vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go delete mode 100644 vendor/github.com/ncruces/go-sqlite3/vfs/os_std_access.go delete mode 100644 vendor/github.com/ncruces/go-sqlite3/vfs/os_std_mode.go (limited to 'vendor/github.com/ncruces/go-sqlite3/vfs') diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go index 176b2507b..ebd42e9ad 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/file.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/file.go @@ -19,17 +19,18 @@ func (vfsOS) FullPathname(path string) (string, error) { if err != nil { return "", err } - fi, err := os.Lstat(path) + return path, testSymlinks(filepath.Dir(path)) +} + +func testSymlinks(path string) error { + p, err := filepath.EvalSymlinks(path) if err != nil { - if errors.Is(err, fs.ErrNotExist) { - return path, nil - } - return "", err + return err } - if fi.Mode()&fs.ModeSymlink != 0 { - err = _OK_SYMLINK + if p != path { + return _OK_SYMLINK } - return path, err + return nil } func (vfsOS) Delete(path string, syncDir bool) error { @@ -74,7 +75,7 @@ func (vfsOS) Open(name string, flags OpenFlag) (File, OpenFlag, error) { } func (vfsOS) OpenFilename(name *Filename, flags OpenFlag) (File, OpenFlag, error) { - var oflags int + oflags := _O_NOFOLLOW if flags&OPEN_EXCLUSIVE != 0 { oflags |= os.O_EXCL } diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/api.go b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/api.go index 843488966..eb12eba09 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/api.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/memdb/api.go @@ -43,7 +43,8 @@ func Create(name string, data []byte) { } // Convert data from WAL/2 to rollback journal. - if len(data) >= 20 && (data[18] == 2 && data[19] == 2 || + if len(data) >= 20 && (false || + data[18] == 2 && data[19] == 2 || data[18] == 3 && data[19] == 3) { data[18] = 1 data[19] = 1 diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go new file mode 100644 index 000000000..87ce58b67 --- /dev/null +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std.go @@ -0,0 +1,47 @@ +//go:build !unix || sqlite3_nosys + +package vfs + +import ( + "io/fs" + "os" +) + +const _O_NOFOLLOW = 0 + +func osAccess(path string, flags AccessFlag) error { + fi, err := os.Stat(path) + if err != nil { + return err + } + if flags == ACCESS_EXISTS { + return nil + } + + const ( + S_IREAD = 0400 + S_IWRITE = 0200 + S_IEXEC = 0100 + ) + + var want fs.FileMode = S_IREAD + if flags == ACCESS_READWRITE { + want |= S_IWRITE + } + if fi.IsDir() { + want |= S_IEXEC + } + if fi.Mode()&want != want { + return fs.ErrPermission + } + return nil +} + +func osSetMode(file *os.File, modeof string) error { + fi, err := os.Stat(modeof) + if err != nil { + return err + } + file.Chmod(fi.Mode()) + return nil +} diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_access.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_access.go deleted file mode 100644 index 1621c0998..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_access.go +++ /dev/null @@ -1,36 +0,0 @@ -//go:build !unix || sqlite3_nosys - -package vfs - -import ( - "io/fs" - "os" -) - -func osAccess(path string, flags AccessFlag) error { - fi, err := os.Stat(path) - if err != nil { - return err - } - if flags == ACCESS_EXISTS { - return nil - } - - const ( - S_IREAD = 0400 - S_IWRITE = 0200 - S_IEXEC = 0100 - ) - - var want fs.FileMode = S_IREAD - if flags == ACCESS_READWRITE { - want |= S_IWRITE - } - if fi.IsDir() { - want |= S_IEXEC - } - if fi.Mode()&want != want { - return fs.ErrPermission - } - return nil -} diff --git a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_mode.go b/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_mode.go deleted file mode 100644 index ac4904773..000000000 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_std_mode.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build !unix || sqlite3_nosys - -package vfs - -import "os" - -func osSetMode(file *os.File, modeof string) error { - fi, err := os.Stat(modeof) - if err != nil { - return err - } - file.Chmod(fi.Mode()) - return nil -} 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 111af799a..7a540889b 100644 --- a/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go +++ b/vendor/github.com/ncruces/go-sqlite3/vfs/os_unix.go @@ -9,6 +9,8 @@ import ( "golang.org/x/sys/unix" ) +const _O_NOFOLLOW = unix.O_NOFOLLOW + func osAccess(path string, flags AccessFlag) error { var access uint32 // unix.F_OK switch flags { -- cgit v1.2.3