From 2ebe63b135b04cacc8cc123a062a81c99ee8416f Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 13 Sep 2023 10:32:16 -0700 Subject: [PATCH] fix: chmod 0755 store/PLUGIN/VER dir Because we're doing `mktemp` (which gives 0700) and then moving it to `$KREW_ROOT/store/PLUGIN/VERSION`, we need to make sure that the directory is 0755 like the other dirs in `store`. --- internal/installation/move.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/internal/installation/move.go b/internal/installation/move.go index f987b132..850c85d7 100644 --- a/internal/installation/move.go +++ b/internal/installation/move.go @@ -161,7 +161,12 @@ func moveToInstallDir(srcDir, installDir string, fos []index.FileOperation) erro tmp, err := os.MkdirTemp("", "krew-temp-move") klog.V(4).Infof("Creating temp plugin move operations dir %q", tmp) if err != nil { - return errors.Wrap(err, "failed to find a temporary director") + return errors.Wrap(err, "failed to find a temporary directory") + } + klog.V(4).Infof("Chmoding tmpdir to 0755", tmp) + if err := os.Chmod(tmp, 0o755); err != nil { + // mktemp gives a 0700 directory but since we move this to KREW_ROOT, we need to make it 0755 + return errors.Wrap(err, "failed to chmod temp directory") } defer os.RemoveAll(tmp)