diff --git a/qubes/device_protocol.py b/qubes/device_protocol.py index 51d5ef1b1..e04340a77 100644 --- a/qubes/device_protocol.py +++ b/qubes/device_protocol.py @@ -560,10 +560,10 @@ def interfaces(self) -> List[DeviceInterface]: @property def parent_device(self) -> Optional[Device]: """ - The parent device if any. + The parent device, if any. - If the device is part of another device (e.g. it's a single - partition of an usb stick), the parent device id should be here. + If the device is part of another device (e.g., it's a single + partition of a USB stick), the parent device id should be here. """ return self._parent @@ -572,7 +572,7 @@ def subdevices(self) -> List['DeviceInfo']: """ The list of children devices if any. - If the device has subdevices (e.g. partitions of an usb stick), + If the device has subdevices (e.g., partitions of a USB stick), the subdevices id should be here. """ return [dev for dev in self.backend_domain.devices[self.devclass] @@ -604,7 +604,7 @@ def serialize(self) -> bytes: if self.attachment: properties = self.pack_property( - properties, 'attachment', self.attachment.name) + 'attachment', self.attachment.name) properties += b' ' + self.pack_property( 'interfaces', @@ -742,6 +742,7 @@ def sanitize_str( if replace_char is None: not_allowed_chars = set(untrusted_value) - allowed_chars if not_allowed_chars: + print(untrusted_value) raise ProtocolError(error_message + repr(not_allowed_chars)) return untrusted_value result = "" diff --git a/qubes/tests/devices.py b/qubes/tests/devices.py index f8d954ee6..b0bc4d4a8 100644 --- a/qubes/tests/devices.py +++ b/qubes/tests/devices.py @@ -491,7 +491,7 @@ def test_030_serialize_and_deserialize(self): serial=None, interfaces=[DeviceInterface(" 112233"), DeviceInterface("&012345")], - **{"additional info": "and='more'", "date": "06.12.23"} + **{"additional_info": "and='more'", "date": "06.12.23"} ) serialized = device.serialize() deserialized = DeviceInfo.deserialize(b'1-1.1.1 ' + serialized, self.vm) diff --git a/qubes/tests/vm/qubesvm.py b/qubes/tests/vm/qubesvm.py index e73f29968..3de6d48da 100644 --- a/qubes/tests/vm/qubesvm.py +++ b/qubes/tests/vm/qubesvm.py @@ -1312,7 +1312,7 @@ def test_600_libvirt_xml_hvm_pcidev(self): vm, # this is violation of API, but for PCI the argument # is unused '00_00.0', - bus='pci', + devclass='pci', persistent=True) vm.devices['pci']._set.add( assignment)