From 8d0f2d7e799a3449b2d7080d9a1926a0546c66f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hozza?= Date: Wed, 18 Jan 2023 17:35:44 +0100 Subject: [PATCH] osbuild/mkdir: make `Mode` a pointer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The default value for the `os.FileMode` is zero, but the actual default value used by the stage if no value is specified in the options is `0777`. By using the pointer, we'll allow one to specify `0000` permissions as a value which won't be omitted from the stage options. Signed-off-by: Tomáš Hozza --- internal/manifest/commit_deployment.go | 2 +- internal/osbuild/mkdir_stage.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/manifest/commit_deployment.go b/internal/manifest/commit_deployment.go index b7edc25ba9..80e58e3fb1 100644 --- a/internal/manifest/commit_deployment.go +++ b/internal/manifest/commit_deployment.go @@ -93,7 +93,7 @@ func (p *OSTreeDeployment) serialize() osbuild.Pipeline { Paths: []osbuild.MkdirStagePath{ { Path: "/boot/efi", - Mode: os.FileMode(0700), + Mode: common.ToPtr(os.FileMode(0700)), }, }, })) diff --git a/internal/osbuild/mkdir_stage.go b/internal/osbuild/mkdir_stage.go index aa478a083e..f77df6b788 100644 --- a/internal/osbuild/mkdir_stage.go +++ b/internal/osbuild/mkdir_stage.go @@ -8,10 +8,10 @@ type MkdirStageOptions struct { } type MkdirStagePath struct { - Path string `json:"path"` - Mode os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777 - Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed - ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists + Path string `json:"path"` + Mode *os.FileMode `json:"mode,omitempty"` // If not specified, the default mode is 0777 + Parents bool `json:"parents,omitempty"` // If true, create parent directories as needed + ExistOk bool `json:"exist_ok,omitempty"` // If true, do not fail if the target directory already exists } func (MkdirStageOptions) isStageOptions() {}