mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-11-03 09:37:34 +00:00
Merge pull request #12211 from vrothberg/3.4-bz-2014149
[3.4] volumes: be more tolerant and fix infinite loop
This commit is contained in:
commit
8de9950038
3 changed files with 10 additions and 4 deletions
|
|
@ -161,7 +161,7 @@ func isPathOnBindMount(c *Container, containerPath string) bool {
|
|||
if cleanedContainerPath == filepath.Clean(m.Destination) {
|
||||
return true
|
||||
}
|
||||
for dest := m.Destination; dest != "/"; dest = filepath.Dir(dest) {
|
||||
for dest := m.Destination; dest != "/" && dest != "."; dest = filepath.Dir(dest) {
|
||||
if cleanedContainerPath == dest {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ EOF
|
|||
cat >$dockerfile <<EOF
|
||||
FROM $IMAGE
|
||||
RUN echo $rand_content > /$rand_filename
|
||||
VOLUME ['/etc/foo', '/etc/bar']
|
||||
EOF
|
||||
|
||||
run_podman buildx build --load -t build_test --format=docker $tmpdir
|
||||
|
|
@ -47,6 +48,14 @@ EOF
|
|||
run_podman run --rm build_test cat /$rand_filename
|
||||
is "$output" "$rand_content" "reading generated file in image"
|
||||
|
||||
# Make sure the volumes are created at surprising yet Docker-compatible
|
||||
# destinations (see bugzilla.redhat.com/show_bug.cgi?id=2014149).
|
||||
run_podman run --rm build_test find /[ /etc/bar\] -print
|
||||
is "$output" "/\[
|
||||
/\[/etc
|
||||
/\[/etc/foo,
|
||||
/etc/bar]" "weird VOLUME gets converted to directories with brackets and comma"
|
||||
|
||||
run_podman rmi -f build_test
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue