Skip to content

Commit 755ff3c

Browse files
committed
Handle leading 0
1 parent 9728679 commit 755ff3c

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

pkg/minikube/assets/addons.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,14 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro
225225
rPath = filepath.Dir(rPath)
226226
vmpath = filepath.Join("/", rPath)
227227
}
228-
// While not technically correct, we add a leading 0 here (this won't account for the higher order permissions)
229-
// Since the leading 0 is stripped when converting to octal.
230-
f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), fmt.Sprintf("0%o", info.Mode().Perm()))
228+
permString := fmt.Sprintf("0%o", info.Mode().Perm())
229+
// The conversion will strip the leading 0 if present, so add it back
230+
// if we need to.
231+
if len(permString) == 3 {
232+
permString = fmt.Sprintf("0%s", permString)
233+
}
234+
235+
f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), permString)
231236
if err != nil {
232237
return errors.Wrapf(err, "creating file asset for %s", hostpath)
233238
}

0 commit comments

Comments
 (0)