summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2009-04-14 13:35:54 -1000
committerDavid Cantrell <dcantrell@redhat.com>2009-04-15 04:23:33 -1000
commited1426e57fcb270483ab4a2d7852a11a65de5109 (patch)
treec5f86446800e07e77d1025145a5432c758cf984c
parent7a57a408966bc2bbe1f6e9a8a0922f3636ef0e87 (diff)
downloadanaconda-ed1426e57fcb270483ab4a2d7852a11a65de5109.tar.gz
anaconda-ed1426e57fcb270483ab4a2d7852a11a65de5109.tar.xz
anaconda-ed1426e57fcb270483ab4a2d7852a11a65de5109.zip
Don't traceback on invalid filesystem detection (#495156)
We may think a partition has a valid filesystem when it really does not. This is easily reproduced with the following steps: 1) Create a partition on some device. 2) Create an NTFS filesystem on that partition. 3) Delete the partition from the device. 4) Divide the device in to two equal sized partitions, but do not create a filesystem on either. Boot the installer and notice that the first partition is assumed to be NTFS, but it's unmountable. In getExistingSize(), we get an FSError traceback when trying to mount the filesyste. The problem is that we haven't zeroed out the new partition or created a new filesystem on top of it. The old filesystem data is still on the disk and is misleading udev and friends. The solution in this patch is to catch the FSError from getExistingSize(). If the mount failed, assume the partition is empty and continue.
-rw-r--r--iw/partition_ui_helpers_gui.py2
-rw-r--r--storage/devicetree.py13
2 files changed, 10 insertions, 5 deletions
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index b7b6b3dbd..1ff2d5f35 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -315,7 +315,7 @@ def createPreExistFSOptionSection(origrequest, maintable, row, mountCombo,
else:
origfs = origrequest.format
- if origfs.formattable:
+ if origfs.formattable or not origfs.type:
formatcb = gtk.CheckButton(label=_("_Format as:"))
maintable.attach(formatcb, 0, 1, row, row + 1)
formatcb.set_active(origfs.formattable and not origfs.exists)
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 7540ff2be..12dd7c38e 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1409,13 +1409,11 @@ class DeviceTree(object):
label = udev_device_get_label(info)
format_type = udev_device_get_format(info)
- log.debug("type is '%s'" % format_type)
-
format = None
if (not device) or (not format_type) or device.format.type:
# this device has no formatting or it has already been set up
# FIXME: this probably needs something special for disklabels
- log.debug("bailing")
+ log.debug("no type or existing type for %s, bailing" % (name,))
return
# set up the common arguments for the format constructor
@@ -1462,7 +1460,14 @@ class DeviceTree(object):
if apple.minSize <= device.size <= apple.maxSize:
args[0] = "appleboot"
- device.format = formats.getFormat(*args, **kwargs)
+ try:
+ log.debug("type detected on '%s' is '%s'" % (name, format_type,))
+ device.format = formats.getFormat(*args, **kwargs)
+ except FSError:
+ log.debug("type '%s' on '%s' invalid, assuming no format" %
+ (format_type, name,))
+ device.format = formats.DeviceFormat()
+ return
#
# now do any special handling required for the device's format