From 9fffdab38a8ac28e0c021974719a5e8cdfe1269a Mon Sep 17 00:00:00 2001 From: eladlachmi <110764839+eladlachmi@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:48:26 +0300 Subject: [PATCH] Fix build failing with Windows target (#7921) --- cmd/lakefs/cmd/flare.go | 6 +----- pkg/flare/permissions_darwin.go | 7 +++++++ pkg/flare/permissions_freebsd.go | 7 +++++++ pkg/flare/permissions_linux.go | 7 +++++++ pkg/flare/permissions_openbsd.go | 7 +++++++ pkg/flare/permissions_windows.go | 5 +++++ 6 files changed, 34 insertions(+), 5 deletions(-) create mode 100644 pkg/flare/permissions_darwin.go create mode 100644 pkg/flare/permissions_freebsd.go create mode 100644 pkg/flare/permissions_linux.go create mode 100644 pkg/flare/permissions_openbsd.go create mode 100644 pkg/flare/permissions_windows.go diff --git a/cmd/lakefs/cmd/flare.go b/cmd/lakefs/cmd/flare.go index 945ce238e84..4276fcaba4c 100644 --- a/cmd/lakefs/cmd/flare.go +++ b/cmd/lakefs/cmd/flare.go @@ -4,9 +4,7 @@ import ( "fmt" "os" "path/filepath" - "runtime" "strings" - "syscall" "time" "github.com/jedib0t/go-pretty/v6/text" @@ -39,9 +37,7 @@ var flareCmd = &cobra.Command{ Args: cobra.ExactArgs(0), PreRun: warnOutputFlags, Run: func(cmd *cobra.Command, args []string) { - if runtime.GOOS != "windows" { - syscall.Umask(flare.FlareUmask) - } + flare.SetBaselinePermissions(flare.FlareUmask) now := strings.ReplaceAll(time.Now().String(), " ", "") cfg := loadConfig() envVarBlacklist := addAppEnvVarPrefix(config.GetSecureStringKeyPaths(cfg)) diff --git a/pkg/flare/permissions_darwin.go b/pkg/flare/permissions_darwin.go new file mode 100644 index 00000000000..6d17243b36b --- /dev/null +++ b/pkg/flare/permissions_darwin.go @@ -0,0 +1,7 @@ +package flare + +import "syscall" + +func SetBaselinePermissions(mask int) { + syscall.Umask(mask) +} diff --git a/pkg/flare/permissions_freebsd.go b/pkg/flare/permissions_freebsd.go new file mode 100644 index 00000000000..6d17243b36b --- /dev/null +++ b/pkg/flare/permissions_freebsd.go @@ -0,0 +1,7 @@ +package flare + +import "syscall" + +func SetBaselinePermissions(mask int) { + syscall.Umask(mask) +} diff --git a/pkg/flare/permissions_linux.go b/pkg/flare/permissions_linux.go new file mode 100644 index 00000000000..6d17243b36b --- /dev/null +++ b/pkg/flare/permissions_linux.go @@ -0,0 +1,7 @@ +package flare + +import "syscall" + +func SetBaselinePermissions(mask int) { + syscall.Umask(mask) +} diff --git a/pkg/flare/permissions_openbsd.go b/pkg/flare/permissions_openbsd.go new file mode 100644 index 00000000000..6d17243b36b --- /dev/null +++ b/pkg/flare/permissions_openbsd.go @@ -0,0 +1,7 @@ +package flare + +import "syscall" + +func SetBaselinePermissions(mask int) { + syscall.Umask(mask) +} diff --git a/pkg/flare/permissions_windows.go b/pkg/flare/permissions_windows.go new file mode 100644 index 00000000000..72a015fac5d --- /dev/null +++ b/pkg/flare/permissions_windows.go @@ -0,0 +1,5 @@ +package flare + +func SetBaselinePermissions(_ int) { + return +}