[gparted] Display libparted "loop" partition tables via "none" instead (#741430)



commit f5c044142c742da40c53c022d8f4f02537158f4c
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Dec 29 10:23:55 2014 +0000

    Display libparted "loop" partition tables via "none" instead (#741430)
    
    For libparted recognised file systems covering the whole disk device,
    libparted reports the partition table as "loop".  With libparted 3.1 and
    earlier, the partition device was reported wrongly as /dev/sdb1, instead
    of /dev/sdb, by the ped_partition_get_path() call.  This causes GParted
    to fail to report file system usage, label and UUID, and busy status.
    Also multiple file system tool command errors from using the wrong
    device are displayed.
    
        # mkfs.ext4 -L whole-ext4 /dev/sdb
        # ./gpartedbin
    
    Example partition errors:
    
        e2label: No such file or directory while trying to open /dev/sdb1
        Couldn't find valid filesystem superblock.
    
        tune2fs 1.42.8 (20-Jun-2013)
        tune2fs: No such file or directory while trying to open /dev/sdb1
        Couldn't find valid filesystem superblock.
    
        dumpe2fs 1.42.8 (20-Jun-2013)
        dumpe2fs: No such file or directory while trying to open /dev/sdb1
        Couldn't find valid filesystem superblock.
    
        Unable to read the contents of this file system!
        Because of this some operations may be unavailable.
        This cause might be a missing software package.
        The following list of software packages is required for ext4 file
        system support: e2fsprogs v1.41+.
    
    This also breaks most of the manipulation operations, again because it
    is using the wrong device name.
    
    Fix by ignoring libparted's "loop" partition table and just let it get
    displayed via the "none" partition table mechanism.
    
    Doing this renders the direction taken in bug 683643 to make GParted
    work with libparted "loop" partition tables mute, as GParted no longer
    works with such partition tables.  Instead they are replaced by "none"
    partition tables within GParted.
    
        Bug 683643 - Doesn't properly support partitionless drives
        https://bugzilla.gnome.org/show_bug.cgi?id=683643
    
    Bug 741430 - GParted cannot recognise LVM signature on unpartitioned
                 drive

 src/GParted_Core.cc |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 5066c3c..e713af6 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -309,8 +309,9 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
                        if ( temp_device .cylsize < (MEBIBYTE / temp_device .sector_size) )
                                temp_device .cylsize = (MEBIBYTE / temp_device .sector_size) ;
                                
-                       //normal harddisk
-                       if ( lp_disk )
+                       // Partitioned drive (excluding "loop"), as recognised by libparted
+                       if ( lp_disk && lp_disk->type && lp_disk->type->name &&
+                            strcmp( lp_disk->type->name, "loop" ) != 0         )
                        {
                                temp_device .disktype = lp_disk ->type ->name ;
                                temp_device .max_prims = ped_disk_get_max_primary_partition_count( lp_disk ) ;
@@ -333,7 +334,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
                                        libparted_messages .clear() ;
                                }
                        }
-                       // Hard disk without a libparted recognised disklabel
+                       // Unpartitioned drive (including "loop"), as recognised by libparted
                        else
                        {
                                std::vector<Glib::ustring> messages;
@@ -341,7 +342,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
                                // Recognised file system signature on whole disk device
                                if ( fstype != FS_UNKNOWN )
                                {
-                                       // Clear the "unrecognised disk label" message
+                                       // Clear the possible "unrecognised disk label" message
                                        libparted_messages.clear();
 
                                        temp_device.disktype = "none";


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