even if the mount target is missing more than one path component. this is still far from ideal, but needed for pct create/restore with complete mountpoint support. --- src/PVE/LXC.pm | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm index 7b4afa2..bffe03c 100644 --- a/src/PVE/LXC.pm +++ b/src/PVE/LXC.pm @@ -952,11 +952,24 @@ sub mountpoint_mount_path { } my $check_mount_path = sub { - my ($path) = @_; - $path = File::Spec->canonpath($path); - my $real = Cwd::realpath($path); - if ($real ne $path) { + my ($path, $rootdir) = @_; + + my $real; + + # only repeat if $rootdir is defined and $path does not exist + do { + $path = File::Spec->canonpath($path); + $real = Cwd::realpath($path); + + # strip last component if $path does not exist at all + $path =~ s!/[^/]+$!! + if !defined($real); + } while (!defined($real) && defined($rootdir) && $rootdir ne $path); + + if (defined($real) && $real ne $path) { die "mount path modified by symlink: $path != $real"; + } else { + return; } }; -- 2.1.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel