Re: [PATCH] Don't traceback on invalid filesystem detection (#495156)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 14, 2009 at 10:26:01PM -1000, David Cantrell wrote:
> 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.
> ---
>  iw/partition_ui_helpers_gui.py |    2 +-
>  storage/devicetree.py          |   13 +++++++++----
>  2 files changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
> index edc4322..86ea47b 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 8c41c50..8994694 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()
Doesn't this have to be "formats.deviceFormat(None)" ?
> +            return
>  
>          #
>          # now do any special handling required for the device's format
> -- 
> 1.6.2.2
> 
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

-- 
Joel Andres Granados
Brno, Czech Republic, Red Hat.

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux