From 21a753c4e2541dbb5def2f8690e21ac97537f989 Mon Sep 17 00:00:00 2001 From: Harold Dost Date: Wed, 12 Aug 2020 23:23:17 +0200 Subject: [PATCH] Make file permissions set to allow for wider umask options. (#7782) 0644 -> 0666 on all non vendored code. Fixes #7717 Signed-off-by: Harold Dost --- cmd/promtool/archive.go | 2 +- tsdb/fileutil/fileutil.go | 2 +- tsdb/fileutil/flock_plan9.go | 2 +- tsdb/fileutil/flock_solaris.go | 2 +- tsdb/fileutil/flock_unix.go | 2 +- tsdb/index/index_test.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/promtool/archive.go b/cmd/promtool/archive.go index 783d8294f4..520c26b63f 100644 --- a/cmd/promtool/archive.go +++ b/cmd/promtool/archive.go @@ -21,7 +21,7 @@ import ( "github.com/pkg/errors" ) -const filePerm = 0644 +const filePerm = 0666 type tarGzFileWriter struct { tarWriter *tar.Writer diff --git a/tsdb/fileutil/fileutil.go b/tsdb/fileutil/fileutil.go index 00bf63950b..927ebe004d 100644 --- a/tsdb/fileutil/fileutil.go +++ b/tsdb/fileutil/fileutil.go @@ -65,7 +65,7 @@ func copyFile(src, dest string) error { return err } - err = ioutil.WriteFile(dest, data, 0644) + err = ioutil.WriteFile(dest, data, 0666) if err != nil { return err } diff --git a/tsdb/fileutil/flock_plan9.go b/tsdb/fileutil/flock_plan9.go index 8a3d44c5e1..71ed67e8c3 100644 --- a/tsdb/fileutil/flock_plan9.go +++ b/tsdb/fileutil/flock_plan9.go @@ -24,7 +24,7 @@ func (l *plan9Lock) Release() error { } func newLock(fileName string) (Releaser, error) { - f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, os.ModeExclusive|0644) + f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, os.ModeExclusive|0666) if err != nil { return nil, err } diff --git a/tsdb/fileutil/flock_solaris.go b/tsdb/fileutil/flock_solaris.go index 7f527ae6c4..cfff8e42f8 100644 --- a/tsdb/fileutil/flock_solaris.go +++ b/tsdb/fileutil/flock_solaris.go @@ -45,7 +45,7 @@ func (l *unixLock) set(lock bool) error { } func newLock(fileName string) (Releaser, error) { - f, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) + f, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0666) if err != nil { return nil, err } diff --git a/tsdb/fileutil/flock_unix.go b/tsdb/fileutil/flock_unix.go index f493fbd831..f6f78d367d 100644 --- a/tsdb/fileutil/flock_unix.go +++ b/tsdb/fileutil/flock_unix.go @@ -40,7 +40,7 @@ func (l *unixLock) set(lock bool) error { } func newLock(fileName string) (Releaser, error) { - f, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0644) + f, err := os.OpenFile(fileName, os.O_RDWR|os.O_CREATE, 0666) if err != nil { return nil, err } diff --git a/tsdb/index/index_test.go b/tsdb/index/index_test.go index f07215d46c..c628181c78 100644 --- a/tsdb/index/index_test.go +++ b/tsdb/index/index_test.go @@ -502,7 +502,7 @@ func TestNewFileReaderErrorNoOpenFiles(t *testing.T) { dir := testutil.NewTemporaryDirectory("block", t) idxName := filepath.Join(dir.Path(), "index") - err := ioutil.WriteFile(idxName, []byte("corrupted contents"), 0644) + err := ioutil.WriteFile(idxName, []byte("corrupted contents"), 0666) testutil.Ok(t, err) _, err = NewFileReader(idxName)