Skip to content

Commit

Permalink
fix(mount): cannot mount path with space in fstab (#55)
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Cui <[email protected]>
  • Loading branch information
BlackHole1 authored Sep 18, 2024
1 parent 24eff7e commit f00dbf0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/vfkit/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package vfkit

import (
"fmt"
"strings"

"github.com/crc-org/vfkit/pkg/config"
)
Expand Down Expand Up @@ -56,7 +57,9 @@ func (m *_mounts) toVFKit() (devices []config.VirtioDevice) {

func (m *_mounts) toFSTAB() (result []string) {
for _, fs := range m.list {
fstab := fmt.Sprintf("%s %s virtiofs defaults 0 0", fs.tag, fs.shareDir)
// See: https://wiki.archlinux.org/title/Fstab#Filepath_spaces
dir := strings.ReplaceAll(fs.shareDir, " ", `\\\\040`)
fstab := fmt.Sprintf("%s %s virtiofs defaults 0 0", fs.tag, dir)
result = append(result, fstab)
}

Expand Down

0 comments on commit f00dbf0

Please sign in to comment.