summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTails developers <tails@boum.org>2015-01-11 17:29:22 +0000
committerTails developers <tails@boum.org>2015-01-14 20:00:40 +0000
commit242ef1cedbc55ee847c4946723105c4acb9b3e07 (patch)
tree43f8620eeccdda9a765c211b600ac40a04aea9fe
parentef36cf0d62de5180f7fd4735dbd9d046b42c6603 (diff)
Remove racy call to rescan_devices() after unmounting target device (Closes: #6092).bugfix/6092-drop-racy-code
As demonstrated in #6092, this call sometimes fails. It's a pile of nested DBus calls, and I'm not surprised to see it's racy when called after sync'ing that many changes on the target device. We could debug it to make it work at that stage, but it would be painful, and this function was actually not meant to support this usecase in the first place. Note that actually, we don't really need to rescan all devices at that point: we just need to have the parent ("full") device in the drives list. However, when we need this, for some reason (probably the hybrid MBR and switch to partition hacks), the drives list only contains the target system partition, so: * let's store, in the _full_drive attribute, not only the parent device name, but all the information we need about it; * let's save this information early enough, when it's still in the drives list; * in switch_back_to_full_drive, we add that information to the drives list.
-rwxr-xr-xliveusb/creator.py16
-rwxr-xr-xliveusb/gui.py2
2 files changed, 11 insertions, 7 deletions
diff --git a/liveusb/creator.py b/liveusb/creator.py
index 20981d6..82721c3 100755
--- a/liveusb/creator.py
+++ b/liveusb/creator.py
@@ -907,24 +907,28 @@ class LinuxLiveUSBCreator(LiveUSBCreator):
else:
return False
+ def save_full_drive(self):
+ self._full_drive = self.drives[self._drive]
+
def switch_drive_to_system_partition(self):
- self._full_drive = self._drive
+ full_drive_name = self._full_drive['device']
append = False
- if self._full_drive.startswith('/dev/sd'):
+ if full_drive_name.startswith('/dev/sd'):
append = '1'
- elif self._full_drive.startswith('/dev/mmcblk'):
+ elif full_drive_name.startswith('/dev/mmcblk'):
append = 'p1'
if not append:
self.log.warning(
_("Unsupported device '%(device)s', please report a bug." %
- {'device': self._full_drive})
+ {'device': full_drive_name})
)
self.log.info(_('Trying to continue anyway.'))
append = '1'
- self.drive = '%s%s' % (self._full_drive, append)
+ self.drive = '%s%s' % (full_drive_name, append)
def switch_back_to_full_drive(self):
- self.drive = self._full_drive
+ self.drives[self._full_drive['device']] = self._full_drive
+ self.drive = self._full_drive['device']
def verify_filesystem(self):
self.log.info(_("Verifying filesystem..."))
diff --git a/liveusb/gui.py b/liveusb/gui.py
index f6e82cc..6ac7ce0 100755
--- a/liveusb/gui.py
+++ b/liveusb/gui.py
@@ -193,6 +193,7 @@ class LiveUSBThread(QtCore.QThread):
self.handler = LiveUSBLogHandler(self.status)
self.live.log.addHandler(self.handler)
self.now = datetime.now()
+ self.live.save_full_drive()
try:
if self.parent.opts.partition:
self.live.unmount_device()
@@ -256,7 +257,6 @@ class LiveUSBThread(QtCore.QThread):
self.live.unmount_device()
if self.parent.opts.partition:
- self.rescan_devices()
self.live.switch_back_to_full_drive()
self.live.remove_hybrid_mbr()