From f1edfd4d63b6252a9a3d14abeba9fbc4a51fe733 Mon Sep 17 00:00:00 2001 From: Fabio Forni Date: Sun, 5 Nov 2023 16:34:57 +0100 Subject: [PATCH] service: Do not set Mode to 0644 by default --- service/service.go | 3 +-- service/service_test.go | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/service/service.go b/service/service.go index dace80f..606cee9 100644 --- a/service/service.go +++ b/service/service.go @@ -145,7 +145,6 @@ type FilePath struct { } // UnmarshalYAML implements the yaml.Unmarshaler interface. -// Mode defaults to 0644 if unspecified in the YAML node. func (lp *FilePath) UnmarshalYAML(node *yaml.Node) error { switch node.Kind { case yaml.ScalarNode: @@ -155,7 +154,7 @@ func (lp *FilePath) UnmarshalYAML(node *yaml.Node) error { return err } lp.Path = path - lp.Mode = 0644 + lp.Mode = 0 default: type noRecursion FilePath var noRec noRecursion diff --git a/service/service_test.go b/service/service_test.go index 3efa777..1217d22 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -117,8 +117,8 @@ links: func TestParseLinksString(t *testing.T) { expect := map[string]service.FilePath{ - "/my/path/file1": {Path: "/tmp/alias1", Mode: 0644}, - "my/path/file2": {Path: "/tmp/alias2", Mode: 0o644}, + "/my/path/file1": {Path: "/tmp/alias1", Mode: 0o000}, + "my/path/file2": {Path: "/tmp/alias2", Mode: 0o000}, } const doc = ` links: @@ -202,8 +202,8 @@ copies: func TestParseCopiesString(t *testing.T) { expect := map[string]service.FilePath{ - "/my/path/file1": {Path: "/tmp/alias1", Mode: 0644}, - "my/path/file2": {Path: "/tmp/alias2", Mode: 0o644}, + "/my/path/file1": {Path: "/tmp/alias1", Mode: 0o000}, + "my/path/file2": {Path: "/tmp/alias2", Mode: 0o000}, } const doc = ` copies: