From bed8e578d78974ab18b8d1a7806bcb3c6a4ac4fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Sun, 5 Jul 2020 20:48:20 +0200 Subject: [PATCH] Removed unused vm.icon_path property The property was not used for anything, but caused numerous problems due to symlinks. fixes QubesOS/qubes-issues#5934 --- qubes/tests/integ/backupcompatibility.py | 6 ---- qubes/tests/vm/dispvm.py | 4 +-- qubes/vm/adminvm.py | 4 --- qubes/vm/qubesvm.py | 39 ------------------------ 4 files changed, 1 insertion(+), 52 deletions(-) diff --git a/qubes/tests/integ/backupcompatibility.py b/qubes/tests/integ/backupcompatibility.py index 3c78de7b..3be56541 100644 --- a/qubes/tests/integ/backupcompatibility.py +++ b/qubes/tests/integ/backupcompatibility.py @@ -184,16 +184,12 @@ class TC_00_BackupCompatibility( os.mkdir(self.fullpath("appvms/test-work")) self.create_whitelisted_appmenus(self.fullpath( "appvms/test-work/whitelisted-appmenus.list")) - os.symlink("/usr/share/qubes/icons/green.png", - self.fullpath("appvms/test-work/icon.png")) self.create_private_img(self.fullpath("appvms/test-work/private.img")) # StandaloneVM os.mkdir(self.fullpath("appvms/test-standalonevm")) self.create_whitelisted_appmenus(self.fullpath( "appvms/test-standalonevm/whitelisted-appmenus.list")) - os.symlink("/usr/share/qubes/icons/blue.png", - self.fullpath("appvms/test-standalonevm/icon.png")) self.create_private_img(self.fullpath( "appvms/test-standalonevm/private.img")) self.create_sparse( @@ -254,8 +250,6 @@ class TC_00_BackupCompatibility( self.create_whitelisted_appmenus(self.fullpath( "vm-templates/test-template-clone/netvm-whitelisted-appmenus" ".list")) - os.symlink("/usr/share/qubes/icons/green.png", - self.fullpath("vm-templates/test-template-clone/icon.png")) os.mkdir( self.fullpath("vm-templates/test-template-clone/apps.templates")) self.create_appmenus( diff --git a/qubes/tests/vm/dispvm.py b/qubes/tests/vm/dispvm.py index de3a7874..25fe4f45 100644 --- a/qubes/tests/vm/dispvm.py +++ b/qubes/tests/vm/dispvm.py @@ -94,9 +94,7 @@ class TC_00_DispVM(qubes.tests.QubesTestCase): self.assertEqual(dispvm.auto_cleanup, True) mock_makedirs.assert_called_once_with( '/var/lib/qubes/appvms/' + dispvm.name, mode=0o775, exist_ok=True) - mock_symlink.assert_called_once_with( - '/usr/share/icons/hicolor/128x128/devices/appvm-red.png', - '/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name)) + mock_symlink.assert_not_called() def test_001_from_appvm_reject_not_allowed(self): with self.assertRaises(qubes.exc.QubesException): diff --git a/qubes/vm/adminvm.py b/qubes/vm/adminvm.py index f02021c3..e5dcf365 100644 --- a/qubes/vm/adminvm.py +++ b/qubes/vm/adminvm.py @@ -213,10 +213,6 @@ class AdminVM(qubes.vm.BaseVM): ''' raise qubes.exc.QubesVMError(self, 'Cannot kill Dom0 fake domain!') - @property - def icon_path(self): - pass - @property def untrusted_qdb(self): '''QubesDB handle for this domain.''' diff --git a/qubes/vm/qubesvm.py b/qubes/vm/qubesvm.py index 0177b9ba..8dd3513b 100644 --- a/qubes/vm/qubesvm.py +++ b/qubes/vm/qubesvm.py @@ -808,10 +808,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): self.dir_path_prefix, self.name) - @property - def icon_path(self): - return os.path.join(self.dir_path, 'icon.png') - @property def conf_file(self): return os.path.join(self.dir_path, 'libvirt.xml') @@ -954,17 +950,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): @qubes.events.handler('property-set:label') def on_property_set_label(self, event, name, newvalue, oldvalue=None): # pylint: disable=unused-argument - if self.icon_path: - try: - os.remove(self.icon_path) - except OSError: - pass - if hasattr(os, "symlink"): - os.symlink(newvalue.icon_path, self.icon_path) - subprocess.call(['sudo', 'xdg-icon-resource', 'forceupdate']) - else: - shutil.copy(newvalue.icon_path, self.icon_path) - # icon is calculated based on label self.fire_event('property-reset:icon', name='icon') @@ -1687,15 +1672,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): 'creation'.format(self.dir_path)) raise - if os.path.exists(self.icon_path): - os.unlink(self.icon_path) - self.log.info('Creating icon symlink: {} -> {}'.format( - self.icon_path, self.label.icon_path)) - if hasattr(os, "symlink"): - os.symlink(self.label.icon_path, self.icon_path) - else: - shutil.copy(self.label.icon_path, self.icon_path) - # fire hooks yield from self.fire_event_async('domain-create-on-disk') @@ -1754,21 +1730,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM): self.storage.verify() assert self.volumes != {} - if src.icon_path is not None \ - and os.path.exists(src.icon_path) \ - and self.icon_path is not None: - if os.path.islink(src.icon_path): - icon_path = os.readlink(src.icon_path) - self.log.info( - 'Creating icon symlink {} -> {}'.format( - self.icon_path, icon_path)) - os.symlink(icon_path, self.icon_path) - else: - self.log.info( - 'Copying icon {} -> {}'.format( - src.icon_path, self.icon_path)) - shutil.copy(src.icon_path, self.icon_path) - # fire hooks yield from self.fire_event_async('domain-clone-files', src=src)