After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 684115 - Reiserfs UUID reading issues on Fedora and CentOS
Reiserfs UUID reading issues on Fedora and CentOS
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2012-09-15 20:30 UTC by Mike Fleetwood
Modified: 2012-10-10 16:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GParted UUID patchset (v1) (13.55 KB, patch)
2012-09-23 20:30 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2012-09-15 20:30:07 UTC
1) For an unmounted reiserfs file system the UUID is displayed as "<no".

2) For a mounted reiserfs file system the UUID is blank and partition
specific error is displayed:
    reiserfstune: Reiserfstune is not allowed to be run on mounted filesystem.

Assume this is a Fedora / CentOS specific issue.
Comment 1 Mike Fleetwood 2012-09-23 20:30:29 UTC
Created attachment 225035 [details] [review]
GParted UUID patchset (v1)

Hi Curtis,

Here's the patchset to fix these issues.  Also contains 3 tidyup
patches.

For the big tidyup patch:
    Update file system specific validation of RFC 4122 UUIDs
which used the RFC4122_NONE_NIL_UUID_REGEXP regular expression in all
the Linux native file system specific read_uuid() methods I did the
following testing:

1) Replaced blkid command with a shell script wrapper which removed all
   UUID information to force GParted to have to call file system
   specific read_uuid() methods.

2) Created 2 copies of every affected file system, one with a default
   UUID and one with an all zero Nil UUID.  All the FS tools have a way
   to set a Nil UUID except btrfs and reiser4.  In those cases use dd to
   overwite the 16 bytes containing the UUID on disk.

3) Test displaying of the UUID in GParted for both default and Nil UUID
   versions of all affected file systems when mounted and unmounted.
   (Turns out that btrfs and xfs file systems with Nil UUIDs can't be
   mounted.  Don't have a kernel which can mount nilfs2 and reiser4).

4) Test ext2 and jfs file systems using random and time generated UUIDs
   to test different "versions" of UUIDs.
   http://www.ietf.org/rfc/rfc4122.txt
   http://en.wikipedia.org/wiki/Universally_unique_identifier

Thanks,
Mike
Comment 2 Curtis Gedak 2012-09-28 22:15:31 UTC
Thank you Mike for identifying this problem and developing a patch.

Do you use Fedora/CentOS yourself?

I thought this would be a quick test but when I tried testing with my Virtual Machines of Fedora 16, and 17, it appears that the package of reiserfs-utils I installed already had the fix (e.g., linked with UUID).  As such I was unable to confirm the problem.  ;-(

From your above list, it appears that you performed fairly extensive testing.

Hence I will proceed to review the patch, and plan to do some elementary testing with perhaps an older distribution or two.
Comment 3 Curtis Gedak 2012-09-28 23:27:08 UTC
My testing has gone well, and I was able to reproduce the problem with a Fedora 15 VM.  :-)

One suggestion for improvement would be to change the
#define RFC4122_NONE_NIL_UUID_REGEXP in Utils.h to a const.
In fact the #define UUID_STRING_LENGTH should be changed to a const as well.

The advantage to using const in C++ over #define is that type checking can be performed at compile time.  With #define there is no type checking available.
Comment 4 Mike Fleetwood 2012-09-30 10:03:02 UTC
Yes I use Fedora 14 on my desktop and multiboot my netbook with Fedora
16 mostly but also Fedora 13 to 15, Red Hat 6.1 and CentOS 6.3.

I guess that your Fedora 16 image is up to date and has this version of
reiserfs-utils installed.  Anyway you reproduced the fault with Fedora
15.

    # rpm -q reiserfs-utils
    reiserfs-utils-3.6.21-5.fc16.i686
    # rpm -q --changelog reiserfs-utils | head
    * Thu Aug 16 2012 Itamar Reis Peixoto <itamar@ispbrasil.com.br> - 2:3.6.21-5
    -  add missing libuuid-devel bz# 660285
    ...


I chose to use a #define for RFC4122_NONE_NIL_UUID_REGEXP so that the
compiler would concatenate the 3 string literals together for the second
regexp_label() parameter.  Using a constant means the 3 strings have to
be concatenated at run time as a C++ string or Glib::ustring type using
cpu and malloced memory. 

Don't really mind which.
Comment 5 Curtis Gedak 2012-09-30 21:01:40 UTC
Since the code is correct either way, and the note about const was only a suggestion, I will commit the patch as it stands.  Most important is that the code works and is maintainable, not whether it uses a #define or a const.  :-)

The patch set in comment #1 has been committed to the git repository for inclusion in the next release of GParted.

The relevant git commits can be viewed at the following links:

Ignore invalid reiserfs UUIDs (#684115)
http://git.gnome.org/browse/gparted/commit/?id=eca986c96d663baadf43dde177342fa046c9cadc

Switch to using debugreiserfs to read the UUID (#684115)
http://git.gnome.org/browse/gparted/commit/?id=ee87cee96f599d7a6d329de5717823d8dc31176e

Switch to using jfs_tune to read the UUID
http://git.gnome.org/browse/gparted/commit/?id=aa16bf545151ce91d98b58eab7b3027c7d89a29a

Update file system specific validation of RFC 4122 UUIDs
http://git.gnome.org/browse/gparted/commit/?id=4f235ecb06a8e6212366257ecfaea5bfa25d461c

Switch to using debugfs.reiser4 to read the label
http://git.gnome.org/browse/gparted/commit/?id=e282b78b4ad90af0ee426812a05a3ce27780e9ae
Comment 6 Curtis Gedak 2012-10-10 16:52:51 UTC
This bug fix has been included in GParted 0.14.0 released on October 10, 2012.