[gparted] Ignore invalid reiserfs UUIDs (#684115)



commit eca986c96d663baadf43dde177342fa046c9cadc
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Sep 15 21:39:14 2012 +0100

    Ignore invalid reiserfs UUIDs (#684115)
    
    On Fedora up to and including Fedora 16 and Red Hat and CentOS up to the
    current 6.3 release the UUID of an unmounted reiserfs file system is
    displayed as "<no" and a GTK markup warning is written to the terminal.
    
    This was because the reiserfs-utils package isn't linked with libuuid
    support so reiserfs file systems were created with a Nil UUID (all
    zeros).  To read the UUID GParted first tries to retrieve the UUID from
    the blkid command output via the FS_Info cache.  Secondly it tries the
    reiserfs file system specific read_uuid() method which uses the first
    space separated word following the text "UUID:", hence it gets "<no".
    
        # debugreiserfs /dev/sda15 2> /dev/null | grep UUID
        UUID: <no libuuid installed>
    
    In September 2012 Red Hat bug 660285 "reiserfstune compiled without UUID
    support" was fixed for Fedora 16 and later releases.  On Fedora with
    this fix applied GParted will display the Nil UUID (all zeros) for a
    previously created reiserfs file system rather than suppressing it.
    
    Only accept valid, none Nil UUIDs in the reiserfs file system specific
    read_uuid() method.
    
    Bug #684115 - Reiserfs UUID reading issues on Fedora and CentOS

 include/Utils.h |    3 +++
 src/reiserfs.cc |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 7cb98a5..9269f73 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -35,6 +35,9 @@
 #include <vector>
 
 #define UUID_STRING_LENGTH 36
+//Match RFC 4122 UUID strings.  Exclude Nil UUID (all zeros) by excluding
+//  zero from the version field nibble.
+#define RFC4122_NONE_NIL_UUID_REGEXP "[[:xdigit:]]{8}-[[:xdigit:]]{4}-[1-9a-fA-F][[:xdigit:]]{3}-[[:xdigit:]]{4}-[[:xdigit:]]{12}"
 
 namespace GParted
 {
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 4e3cc90..bb85710 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -129,7 +129,7 @@ void reiserfs::read_uuid( Partition & partition )
 {
 	if ( ! Utils::execute_command( "reiserfstune " + partition .get_path(), output, error, true ) )
 	{
-		partition .uuid = Utils::regexp_label( output, "^UUID:[[:blank:]]*([^[:space:]]*)" ) ;
+		partition .uuid = Utils::regexp_label( output, "^UUID:[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")" ) ;
 	}
 	else
 	{



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