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 673245 - Queuing a New UUID erases Partition Used and Unused Space
Queuing a New UUID erases Partition Used and Unused Space
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
0.12.0
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2012-03-31 16:29 UTC by Curtis Gedak
Modified: 2012-04-09 20:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fixes for erasing size and/or flags after queuing new UUID & new Label (2.98 KB, patch)
2012-04-01 09:16 UTC, Rogier
none Details | Review

Description Curtis Gedak 2012-03-31 16:29:43 UTC
When you select a partition and choose to add an operation to set a New UUID, the columns for Used and Unused values are set to '---'.

The lack of values for Used and Unused is also evident in the graphic in that the light yellow space signifying the percentage used disappears.

Any partition flags in the Flags column also disappear.
Comment 1 Rogier 2012-04-01 09:16:00 UTC
Created attachment 211067 [details] [review]
Fixes for erasing size and/or flags after queuing new UUID & new Label

Hi Curtis,

I don't know how the lines that set partition size got lost. They must have been there at some point...

Anyway, the attached patch fixes the problem.

As the code started its life as a copy of the new-label code, I also checked that code, and whereas it does set the sizes correctly, it also loses the partition flags. I fixed that as well.

As I didn't see any good reason for manually initializing the new partition object, which is error-prone, (as is shown by this bug, as well by the corresponding bug in the new-label code), I replaced it with a plain object copy using assignment. Similar assignments are used elsewhere as well. Would you know of any circumstances where this fails ?

Regards,

Rogier.
Comment 2 Curtis Gedak 2012-04-01 19:06:20 UTC
Thanks Rogier for the patch and also for identifying the missing flags problem after setting the label.  Good catch!

(In reply to comment #1)
> I don't know how the lines that set partition size got lost. They must have
> been there at some point...

That is a bit of a mystery.  Perhaps I deleted these lines accidentally at some point?  If I did then I do apologize for this error.


> As I didn't see any good reason for manually initializing the new partition
> object, which is error-prone, (as is shown by this bug, as well by the
> corresponding bug in the new-label code), I replaced it with a plain object
> copy using assignment. Similar assignments are used elsewhere as well.

Your proposed solution of copying the partition object should work properly, and is more elegant than the previous code.


> Would you know of any circumstances where this fails ?

I will think upon this for a while before committing the changes.

In C++ I know that sometimes special handling is needed for the copy constructor. Perhaps this might have been the original reason for separate code to set partition values?
Comment 3 Curtis Gedak 2012-04-02 16:45:39 UTC
After some testing, I have find no problems with these patches.  The cleaner code is also appreciated and should help to make GParted easier to maintain.

These two enhancements have 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:

Fix for FS size & flags becoming unknown after change UUID
http://git.gnome.org/browse/gparted/commit/?id=ea26fcb4fafad20b7300473b3c19c45856bf2db0

Fix for FS flags becoming unknown after change label
http://git.gnome.org/browse/gparted/commit/?id=a5242a28f4292a06f905bc89f53311831404b5e1
Comment 4 Curtis Gedak 2012-04-09 20:14:56 UTC
The enhancements for this bug report have been included in GParted 0.12.1 released on April 9, 2012.