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 685656 - GParted doesn't notice when file system label is changed to blank
GParted doesn't notice when file system label is changed to blank
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-10-07 13:01 UTC by Mike Fleetwood
Modified: 2012-12-12 18:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GParted blank label patchset (v1) (36.67 KB, patch)
2012-10-12 14:12 UTC, Mike Fleetwood
none Details | Review
GParted blank label patchset (v2) (36.94 KB, patch)
2012-10-21 10:17 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2012-10-07 13:01:44 UTC
Originally discussed within forum thread:
    GParted device refresh speed
    http://gparted-forum.surf4.info/viewtopic.php?pid=30021#p30021

Steps to reproduce:
1) Create any file system, setting the label to something.
2) Clear the label.
The original label from step 1) is displayed.  Using "blkid /dev/DISK"
on the command line also displays the label from step 1).  Using the
file system specific tool correctly shows the label is blank.  True for
all the file systems I tested: btrfs, ext2/3/4, fat16/32, jfs, nilfs2,
reiserfs and xfs.

Analysis:
GParted reads the label using the file system specific method and
correctly sets the label to a zero length string.  Then
GParted_Core::set_device_partitions() decides that the label hasn't been
set and calls FS_Info::get_label() to read the label from the cache of
blkid output.  It gets the previous value.  Both GParted and blkid are
broken in not recognising the label being set to blank.

Emailed bug report to util-linux mailing list:
    bug: blkid doesn't notice when fs labels change to blank
    http://gparted-forum.surf4.info/viewtopic.php?pid=30021#p30021

I'm working of a fix,
Mike
Comment 1 Mike Fleetwood 2012-10-12 14:12:40 UTC
Created attachment 226330 [details] [review]
GParted blank label patchset (v1)

Hi Curtis,

Here's the fix patchset.  I tried changing Partition::label into a
pointer to a Glib::ustring, but that was a mess of having to check for
a NULL pointer and deal with storage allocation everywhere so I did this
instead.

Thanks,
Mike
Comment 2 Mike Fleetwood 2012-10-21 10:17:41 UTC
Created attachment 226919 [details] [review]
GParted blank label patchset (v2)

Here's version 2 of the patchset.  The only change is rewording of the
message for the second commit:
    Recognise when Linux swap label is changed to blank

There is one question though.  Does this version of GParted need to cope
with being run of a distribution that is so old it doesn't have blkid?
This second commit would mean that the label of swap would not be read
and displayed as blank.  The fix for this is to enhance
FS_Info::get_label() so that when blkid isn't available it falls back to
using vol_id to read labels.  It's just that to test this extra fix I
have to install a distro that is so old it has vol_id and not blkid.
Comment 3 Curtis Gedak 2012-10-21 16:31:24 UTC
(In reply to comment #2)
> There is one question though.  Does this version of GParted need to cope
> with being run of a distribution that is so old it doesn't have blkid?

As a general rule we try to ensure that GParted compiles and runs on all the currently supported major GNU/Linux distributions.  This might not always be reasonable to do, but so far we have managed to meet this goal.

I think the oldest currently supported distribution would be Ubuntu 8.04 LTS (Server) which is supported until April 2013.
http://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29

From running my Ubuntu 8.04 desktop VM, it appears that blkid is present in this edition so I think we should be okay to rely on the existence of blkid.

Besides, the side effect of not reading a swap label on a really old distribution is fairly minor.

Thanks again for this patch Mike.  I hope to review this patch in the next week or so.  Things are pretty busy for me, especially with trying to finish writing a book on GParted that is tentatively scheduled for release on November 10th.
Comment 4 Mike Fleetwood 2012-10-21 16:45:04 UTC
I have done some more research regarding blkid.  It has been part of
util-linux from version 2.15, released May 2009.  Before that it was
part of e2fsprogs as far back as version 1.33, released in Apr 2003.  So
blkid will likely exist in all distros we want to support and as you say
it's not a significant loss of functionality if it's not there.
Comment 5 Curtis Gedak 2012-11-03 20:23:29 UTC
Hi Mike,

Great work on this patch set.  My testing went well, and everything looked good in reviewing the code.

If you agree that this is ready to go, then we can commit this to the git repository.

Would you like to perform the commit, or shall I?

Regards,
Curtis
Comment 6 Mike Fleetwood 2012-11-04 12:37:25 UTC
Patchset "GParted blank label patchset (v2)" from comment #2 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:

Make GParted recognise reading blank file system labels (#685656)
http://git.gnome.org/browse/gparted/commit/?id=686ec8f713d67c71a3a372e98141b86e38860679

Recognise when Linux swap label is changed to blank (#685656)
http://git.gnome.org/browse/gparted/commit/?id=5ca702019efe4f16bbe616992d25569d3d307eef
Comment 7 Mike Fleetwood 2012-11-14 18:26:26 UTC
FYI.

A fix for blkid not recognising when a file system label is changed to blank has also been committed to util-linux by its maintainer.  Presume it will be included in the next release of util-linux after the current 2.22.1.

Git commit can be viewed at the following link:

libblkid: remove obsolete tags from cache
https://git.kernel.org/?p=utils/util-linux/util-linux.git;a=commitdiff;h=1f8590b56b8a461014acb3b7d041c1af3f658613
Comment 8 Curtis Gedak 2012-12-12 18:09:50 UTC
The enhancements to address this bug report have been included in GParted 0.14.1 released on December 12, 2012.