Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1825790 Implement safer file based token cache #1327

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion arrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ func TestArrowMemoryCleanedUp(t *testing.T) {
mem,
)

rows := dbt.mustQueryContext(ctx, "select 1 UNION select 2")
rows := dbt.mustQueryContext(ctx, "select 1 UNION select 2 order by 1")
defer rows.Close()
var v int
assertTrueF(t, rows.Next())
Expand Down
25 changes: 25 additions & 0 deletions os_specific_posix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//go:build darwin || linux

package gosnowflake

import (
"fmt"
"os"
"syscall"
)

func provideFileOwner(file *os.File) (uint32, error) {
info, err := file.Stat()
if err != nil {
return 0, err
}
return provideOwnerFromStat(info, file.Name())
}

func provideOwnerFromStat(info os.FileInfo, filepath string) (uint32, error) {
nativeStat, ok := info.Sys().(*syscall.Stat_t)
if !ok {
return 0, fmt.Errorf("cannot cast file info for %v to *syscall.Stat_t", filepath)
}
return nativeStat.Uid, nil
}
12 changes: 12 additions & 0 deletions os_specific_windows.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// go:build windows

package gosnowflake

import (
"errors"
"os"
)

func provideFileOwner(file *os.File) (uint32, error) {
return 0, errors.New("provideFileOwner is unsupported on windows")
}
Loading
Loading