From 21345b4f23d4fa4351922019b4991a446d4212b7 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Mon, 20 Nov 2023 11:18:12 +0100 Subject: [PATCH] parse: support `no-dereference` mount option Requries crun 1.11+ where the option is called `copy-symlink`. Required in containers/podman/pull/20356. Part-of: issues.redhat.com/browse/RUN-1935 Signed-off-by: Valentin Rothberg --- pkg/parse/parse.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/parse/parse.go b/pkg/parse/parse.go index 7629f5842..284751e52 100644 --- a/pkg/parse/parse.go +++ b/pkg/parse/parse.go @@ -14,7 +14,7 @@ import ( // ValidateVolumeOpts validates a volume's options func ValidateVolumeOpts(options []string) ([]string, error) { - var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir, foundCopy int + var foundRootPropagation, foundRWRO, foundLabelChange, bindType, foundExec, foundDev, foundSuid, foundChown, foundUpperDir, foundWorkDir, foundCopy, foundCopySymlink int finalOpts := make([]string, 0, len(options)) for _, opt := range options { // support advanced options like upperdir=/path, workdir=/path @@ -93,6 +93,11 @@ func ValidateVolumeOpts(options []string) ([]string, error) { if foundCopy > 1 { return nil, fmt.Errorf("invalid options %q, can only specify 1 'copy' or 'nocopy' option", strings.Join(options, ", ")) } + case "no-dereference": + foundCopySymlink++ + if foundCopySymlink > 1 { + return nil, fmt.Errorf("invalid options %q, can only specify 1 'no-dereference' option", strings.Join(options, ", ")) + } default: return nil, fmt.Errorf("invalid option type %q", opt) }