Skip to content

Commit f00dbf0

Browse files
authored
fix(mount): cannot mount path with space in fstab (#55)
Signed-off-by: Kevin Cui <[email protected]>
1 parent 24eff7e commit f00dbf0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/vfkit/mount.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package vfkit
55

66
import (
77
"fmt"
8+
"strings"
89

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

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

0 commit comments

Comments
 (0)