Skip to content

Commit 04a4bf0

Browse files
committed
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`. Fixes #840.
1 parent 343e657 commit 04a4bf0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/installation/move.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ func moveToInstallDir(srcDir, installDir string, fos []index.FileOperation) erro
161161
tmp, err := os.MkdirTemp("", "krew-temp-move")
162162
klog.V(4).Infof("Creating temp plugin move operations dir %q", tmp)
163163
if err != nil {
164-
return errors.Wrap(err, "failed to find a temporary director")
164+
return errors.Wrap(err, "failed to find a temporary directory")
165+
}
166+
klog.V(4).Infof("Chmoding tmpdir to 0755", tmp)
167+
if err := os.Chmod(tmp, 0o755); err != nil {
168+
// mktemp gives a 0700 directory but since we move this to KREW_ROOT, we need to make it 0755
169+
return errors.Wrap(err, "failed to chmod temp directory")
165170
}
166171
defer os.RemoveAll(tmp)
167172

0 commit comments

Comments
 (0)