summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorValentin Rothberg <rothberg@redhat.com>2021-10-27 17:30:37 +0200
committerValentin Rothberg <rothberg@redhat.com>2021-10-28 16:37:33 +0200
commitc5f0a5d788dafd94ea609b82d94cd089b30a7073 (patch)
tree0a4c36dcf48028fc2ee45125a403c7b3dcab0d26 /pkg/specgen
parent979b6312286b4bd993d7be0413e1e95c4a0bad56 (diff)
downloadpodman-c5f0a5d788dafd94ea609b82d94cd089b30a7073.tar.gz
podman-c5f0a5d788dafd94ea609b82d94cd089b30a7073.tar.bz2
podman-c5f0a5d788dafd94ea609b82d94cd089b30a7073.zip
volumes: be more tolerant and fix infinite loop
Make Podman more tolerant when parsing image volumes during container creation and further fix an infinite loop when checking them. Consider `VOLUME ['/etc/foo', '/etc/bar']` in a Containerfile. While it looks correct to the human eye, the single quotes are wrong and yield the two volumes to be `[/etc/foo,` and `/etc/bar]` in Podman and Docker. When running the container, it'll create a directory `bar]` in `/etc` and a directory `[` in `/` with two subdirectories `etc/foo,`. This behavior is surprising to me but how Docker behaves. We may improve on that in the future. Note that the correct way to syntax for volumes in a Containerfile is `VOLUME /A /B /C` or `VOLUME ["/A", "/B", "/C"]`; single quotes are not supported. This change restores this behavior without breaking container creation or ending up in an infinite loop. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2014149 Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/storage.go3
1 files changed, 0 insertions, 3 deletions
diff --git a/pkg/specgen/generate/storage.go b/pkg/specgen/generate/storage.go
index 3fde1a1b4..30248a886 100644
--- a/pkg/specgen/generate/storage.go
+++ b/pkg/specgen/generate/storage.go
@@ -214,9 +214,6 @@ func getImageVolumes(ctx context.Context, img *libimage.Image, s *specgen.SpecGe
}
for volume := range inspect.Config.Volumes {
logrus.Debugf("Image has volume at %q", volume)
- if err = parse.ValidateVolumeCtrDir(volume); err != nil {
- return nil, nil, err
- }
cleanDest := filepath.Clean(volume)
switch mode {
case "", "anonymous":