From 7be05a6f44291aed238c5d1836b84c9506c3f1cf Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Wed, 22 Nov 2023 11:22:38 +0100 Subject: [PATCH] mount: bind-recursive: remove boolean convenience values - updates fc6976db45e24cc2baff50d806402ae2a8468a13 - updates 74bace156ccfcee69c3c0ac84806ed488adb69e0 Commit fc6976db45e24cc2baff50d806402ae2a8468a13 introduced support for the `bind-recursive` option on `--mount`, and deprecated the `bind-nonrecursive` option. Unlike `bind-nonrecursive` boolean, the `bind-recursive` option accepts a string value with multiple options. For convenience, the `bind-recursive` option also was made to accept boolean values (true/false, 1/0). However, as the option works as the _reverse_ of `bind-nonrecursive` (`bind-nonrecursive=true` === `bind-recursive=false`), the new option won't be a "drop-in" replacement, and having more options to choose from may only be adding more complexity / cognitive overload. This patch removes support for boolean values; if we see a need to add support for boolean values in future, it would be trivial to add back this functionality. Signed-off-by: Sebastiaan van Stijn --- docs/reference/commandline/service_create.md | 8 ++++---- opts/mount.go | 11 +---------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/docs/reference/commandline/service_create.md b/docs/reference/commandline/service_create.md index 442df249e3..75d08e551b 100644 --- a/docs/reference/commandline/service_create.md +++ b/docs/reference/commandline/service_create.md @@ -442,13 +442,13 @@ The following options can only be used for bind mounts (`type=bind`): A value is one of:

diff --git a/opts/mount.go b/opts/mount.go index e2c7e039f7..3ab9b36d64 100644 --- a/opts/mount.go +++ b/opts/mount.go @@ -116,16 +116,7 @@ func (m *MountOpt) Set(value string) error { } logrus.Warn("bind-nonrecursive is deprecated, use bind-recursive=disabled instead") case "bind-recursive": - valS := val - // Allow boolean as an alias to "enabled" or "disabled" - if b, err := strconv.ParseBool(valS); err == nil { - if b { - valS = "enabled" - } else { - valS = "disabled" - } - } - switch valS { + switch val { case "enabled": // read-only mounts are recursively read-only if Engine >= v25 && kernel >= v5.12, otherwise writable // NOP case "disabled": // alias of bind-nonrecursive=true