diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-11-25 16:43:53 +0100 |
---|---|---|
committer | Paul Holzinger <paul.holzinger@web.de> | 2020-11-26 12:55:33 +0100 |
commit | f7f85fef7c7086a39e57eb36e875209bb9553f4e (patch) | |
tree | 0e47e8982f9113ca487d9a3aadf1d9f4f0d0dd88 | |
parent | d4083954f26761b66f9165e40b08d1e6fe989c1c (diff) | |
download | podman-f7f85fef7c7086a39e57eb36e875209bb9553f4e.tar.gz podman-f7f85fef7c7086a39e57eb36e875209bb9553f4e.tar.bz2 podman-f7f85fef7c7086a39e57eb36e875209bb9553f4e.zip |
Do not validate the volume source path in specgen
The volume src path should not be validated in specgen since
the remote client also uses that part and the path must only
exists on the server. This now fails later and only on the
server and not the client.
I don't think I can add a test for this because the CI runs
server and client always on the same vm.
Fixes #8473
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
-rw-r--r-- | cmd/podman/common/volumes.go | 4 | ||||
-rw-r--r-- | pkg/specgen/volumes.go | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/cmd/podman/common/volumes.go b/cmd/podman/common/volumes.go index 0468f15e0..dfbb7b1b2 100644 --- a/cmd/podman/common/volumes.go +++ b/cmd/podman/common/volumes.go @@ -323,8 +323,8 @@ func getBindMount(args []string) (spec.Mount, error) { if len(kv) == 1 { return newMount, errors.Wrapf(optionArgError, kv[0]) } - if err := parse.ValidateVolumeHostDir(kv[1]); err != nil { - return newMount, err + if len(kv[1]) == 0 { + return newMount, errors.Wrapf(optionArgError, "host directory cannot be empty") } newMount.Source = kv[1] setSource = true diff --git a/pkg/specgen/volumes.go b/pkg/specgen/volumes.go index 1178f9960..41efee3b3 100644 --- a/pkg/specgen/volumes.go +++ b/pkg/specgen/volumes.go @@ -84,11 +84,10 @@ func GenVolumeMounts(volumeFlag []string) (map[string]spec.Mount, map[string]*Na return nil, nil, nil, err } } - // Do not check source dir for anonymous volumes if len(splitVol) > 1 { - if err := parse.ValidateVolumeHostDir(src); err != nil { - return nil, nil, nil, err + if len(src) == 0 { + return nil, nil, nil, errors.New("host directory cannot be empty") } } if err := parse.ValidateVolumeCtrDir(dest); err != nil { |