GNOME Bugzilla – Bug 673245
Queuing a New UUID erases Partition Used and Unused Space
Last modified: 2012-04-09 20:14:56 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.
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.
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?
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
The enhancements for this bug report have been included in GParted 0.12.1 released on April 9, 2012.