DispVM: Do not overwrite properties set explicitly

The initializer of the class DispVM first calls the initializer of the
QubesVM class, which among other things sets properties as specified in
kwargs, and then copies over the properties of the template. This can
lead to properties passed explicitly by the caller through kwargs being
overwritten.

Hence only clone properties of the template that are still set to
default in the DispVM.

Fixes QubesOS/qubes-issues#4556
This commit is contained in:
Malte Leip 2019-06-02 17:58:19 +02:00
parent 2010decfaf
commit 94c675f7bb
No known key found for this signature in database
GPG Key ID: 94B1C2BAB08E828E

View File

@ -116,7 +116,10 @@ class DispVM(qubes.vm.qubesvm.QubesVM):
# by default inherit properties from the DispVM template
proplist = [prop.__name__ for prop in template.property_list()
if prop.clone and prop.__name__ not in ['template']]
self_props = [prop.__name__ for prop in self.property_list()]
# Do not overwrite properties that have already been set to a
# non-default value.
self_props = [prop.__name__ for prop in self.property_list()
if self.property_is_default(prop)]
self.clone_properties(template, set(proplist).intersection(
self_props))