Skip to content

Commit 28e1604

Browse files
committed
Revert "cmd/mount: preserve parameter values in fstab options (#6412)"
This reverts commit 2c5520d.
1 parent 252296b commit 28e1604

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

cmd/mount_unix.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -666,27 +666,25 @@ func tellFstabOptions(c *cli.Context) string {
666666
continue
667667
}
668668
s = strings.TrimLeft(s, "-")
669-
paramName := strings.Split(s, "=")[0]
670-
if !c.IsSet(paramName) || paramName == "update-fstab" || paramName == "background" || paramName == "d" {
669+
s = strings.Split(s, "=")[0]
670+
if !c.IsSet(s) || s == "update-fstab" || s == "background" || s == "d" {
671671
continue
672672
}
673-
if paramName == "o" {
674-
opts = append(opts, c.String(paramName))
675-
} else if strings.Contains(s, "=") {
673+
if s == "o" {
674+
opts = append(opts, c.String(s))
675+
} else if v := c.Bool(s); v {
676676
opts = append(opts, s)
677-
} else if v := c.Bool(paramName); v {
678-
opts = append(opts, paramName)
679-
} else if paramName == "cache-dir" {
677+
} else if s == "cache-dir" {
680678
var dirString string
681-
if c.String(paramName) == "memory" {
679+
if c.String(s) == "memory" {
682680
dirString = "memory"
683681
} else {
684-
dirs := utils.SplitDir(c.String(paramName))
682+
dirs := utils.SplitDir(c.String(s))
685683
dirString = strings.Join(relPathToAbs(dirs), string(os.PathListSeparator))
686684
}
687-
opts = append(opts, fmt.Sprintf("%s=%s", paramName, dirString))
685+
opts = append(opts, fmt.Sprintf("%s=%s", s, dirString))
688686
} else {
689-
opts = append(opts, fmt.Sprintf("%s=%s", paramName, c.Generic(paramName)))
687+
opts = append(opts, fmt.Sprintf("%s=%s", s, c.Generic(s)))
690688
}
691689
}
692690
sort.Strings(opts)

0 commit comments

Comments
 (0)