[pve-devel] applied: [PATCH guest-common] fix config_with_pending_array for falsy current values

Thomas Lamprecht t.lamprecht at proxmox.com
Wed May 20 17:10:05 CEST 2020


one could have a config with:
> acpi: 0

and a pending deletion for that to restore the default 1 value.

The config_with_pending_array method then pushed the key twice, one
in the loop iterating the config itself correctly and once in the
pending delete hash, which is normally only for those options not yet
referenced in the config at all. Here the check was on "truthiness"
not definedness, fix that.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 PVE/GuestHelpers.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/GuestHelpers.pm b/PVE/GuestHelpers.pm
index 1688c5c..bc53b32 100644
--- a/PVE/GuestHelpers.pm
+++ b/PVE/GuestHelpers.pm
@@ -231,8 +231,8 @@ sub config_with_pending_array {
     }
 
     while (my ($opt, $force) = each %$pending_delete_hash) {
-	next if $conf->{pending}->{$opt}; # just to be sure
-	next if $conf->{$opt};
+	next if defined($conf->{pending}->{$opt});
+	next if defined($conf->{$opt});
 	my $item = { key => $opt, delete => ($force ? 2 : 1)};
 	push @$res, $item;
     }
-- 
2.20.1





More information about the pve-devel mailing list