Skip to content

Commit

Permalink
Handle leading 0
Browse files Browse the repository at this point in the history
  • Loading branch information
r2d4 committed Oct 23, 2017
1 parent 9728679 commit 633fc4a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,14 @@ func addMinikubeDirToAssets(basedir, vmpath string, assets *[]CopyableFile) erro
rPath = filepath.Dir(rPath)
vmpath = filepath.Join("/", rPath)
}
// While not technically correct, we add a leading 0 here (this won't account for the higher order permissions)
// Since the leading 0 is stripped when converting to octal.
f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), fmt.Sprintf("0%o", info.Mode().Perm()))
permString := fmt.Sprintf("%o", info.Mode().Perm())
// The conversion will strip the leading 0 if present, so add it back
// if we need to.
if len(permString) == 3 {
permString = fmt.Sprintf("0%s", permString)
}

f, err := NewFileAsset(hostpath, vmpath, filepath.Base(hostpath), permString)
if err != nil {
return errors.Wrapf(err, "creating file asset for %s", hostpath)
}
Expand Down

0 comments on commit 633fc4a

Please sign in to comment.