From eca986c96d663baadf43dde177342fa046c9cadc Mon Sep 17 00:00:00 2001 From: Mike Fleetwood Date: Sat, 15 Sep 2012 21:39:14 +0100 Subject: [PATCH] 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 " /dev/null | grep UUID UUID: 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 deletion(-) diff --git a/include/Utils.h b/include/Utils.h index 7cb98a51..9269f73e 100644 --- a/include/Utils.h +++ b/include/Utils.h @@ -35,6 +35,9 @@ #include #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 4e3cc906..bb85710c 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 {