From f84f51d0e70efbff2fc5b16965144b715d7f17b6 Mon Sep 17 00:00:00 2001 From: eladlachmi <110764839+eladlachmi@users.noreply.github.com> Date: Sun, 30 Jun 2024 15:27:03 +0300 Subject: [PATCH] Fix build constraints export from flare package (#7937) --- pkg/flare/flare.go | 6 ++++++ pkg/flare/permissions_darwin.go | 2 +- pkg/flare/permissions_freebsd.go | 2 +- pkg/flare/permissions_linux.go | 2 +- pkg/flare/permissions_openbsd.go | 2 +- pkg/flare/permissions_windows.go | 2 +- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/pkg/flare/flare.go b/pkg/flare/flare.go index e96dc91ff82..becf6d7e58b 100644 --- a/pkg/flare/flare.go +++ b/pkg/flare/flare.go @@ -171,6 +171,12 @@ func (f *Flare) ProcessEnvVars(outPath, fileName string, getWriterFunc GetFileWr return nil } +// SetBaselinePermissions sets the Umask for all files created by flare for posix operating systems +// on Windows this is a noop as permissions are set according to the parent directory +func SetBaselinePermissions(mask int) { + setBaselinePermissions(mask) +} + func (f *Flare) processEnvVars(w io.Writer) error { for _, e := range os.Environ() { for _, p := range f.envVarPrefixes { diff --git a/pkg/flare/permissions_darwin.go b/pkg/flare/permissions_darwin.go index 6d17243b36b..4e3a8855fcb 100644 --- a/pkg/flare/permissions_darwin.go +++ b/pkg/flare/permissions_darwin.go @@ -2,6 +2,6 @@ package flare import "syscall" -func SetBaselinePermissions(mask int) { +func setBaselinePermissions(mask int) { syscall.Umask(mask) } diff --git a/pkg/flare/permissions_freebsd.go b/pkg/flare/permissions_freebsd.go index 6d17243b36b..4e3a8855fcb 100644 --- a/pkg/flare/permissions_freebsd.go +++ b/pkg/flare/permissions_freebsd.go @@ -2,6 +2,6 @@ package flare import "syscall" -func SetBaselinePermissions(mask int) { +func setBaselinePermissions(mask int) { syscall.Umask(mask) } diff --git a/pkg/flare/permissions_linux.go b/pkg/flare/permissions_linux.go index 6d17243b36b..4e3a8855fcb 100644 --- a/pkg/flare/permissions_linux.go +++ b/pkg/flare/permissions_linux.go @@ -2,6 +2,6 @@ package flare import "syscall" -func SetBaselinePermissions(mask int) { +func setBaselinePermissions(mask int) { syscall.Umask(mask) } diff --git a/pkg/flare/permissions_openbsd.go b/pkg/flare/permissions_openbsd.go index 6d17243b36b..4e3a8855fcb 100644 --- a/pkg/flare/permissions_openbsd.go +++ b/pkg/flare/permissions_openbsd.go @@ -2,6 +2,6 @@ package flare import "syscall" -func SetBaselinePermissions(mask int) { +func setBaselinePermissions(mask int) { syscall.Umask(mask) } diff --git a/pkg/flare/permissions_windows.go b/pkg/flare/permissions_windows.go index 72a015fac5d..7c2a6083c37 100644 --- a/pkg/flare/permissions_windows.go +++ b/pkg/flare/permissions_windows.go @@ -1,5 +1,5 @@ package flare -func SetBaselinePermissions(_ int) { +func setBaselinePermissions(_ int) { return }