Skip to content

Commit

Permalink
bundle: Make sure perms of unpacked bundle are 0755
Browse files Browse the repository at this point in the history
The libvirt driver will access the bundle qcow2 image as qemu:qemu,
if the permissions are too restrictive, this will fail.
This is  an issue when umask is set to non default values on linux.
This should fix #2477
  • Loading branch information
cfergeau authored and praveenkumar committed Sep 9, 2021
1 parent 8ac1f3a commit d296029
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/crc/machine/bundle/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,17 @@ func (repo *Repository) Extract(path string) error {
bundleBaseDir := GetBundleNameWithoutExtension(bundleName)
bundleDir := filepath.Join(repo.CacheDir, bundleBaseDir)
_ = os.RemoveAll(bundleDir)
return crcerrors.Retry(context.Background(), time.Minute, func() error {
err := crcerrors.Retry(context.Background(), time.Minute, func() error {
if err := os.Rename(filepath.Join(tmpDir, bundleBaseDir), bundleDir); err != nil {
return &crcerrors.RetriableError{Err: err}
}
return nil
}, 5*time.Second)
if err != nil {
return err
}

return os.Chmod(bundleDir, 0755)
}

func (repo *Repository) List() ([]CrcBundleInfo, error) {
Expand Down

0 comments on commit d296029

Please sign in to comment.