Skip to content

Commit

Permalink
fix: chmod 0755 store/PLUGIN/VER dir
Browse files Browse the repository at this point in the history
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`.

Fixes #840.
  • Loading branch information
ahmetb committed Sep 13, 2023
1 parent 343e657 commit 04a4bf0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/installation/move.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 04a4bf0

Please sign in to comment.