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 672654 - Pasting into an existing partition may shrink GParted's representation of it
Pasting into an existing partition may shrink GParted's representation of it
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-03-22 20:56 UTC by Mike Fleetwood
Modified: 2012-04-09 20:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GParted partition alignment uninitialised read patch (3.87 KB, patch)
2012-03-23 18:13 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2012-03-22 20:56:05 UTC
Copy and pasting into an existing partition may result in GParted's
representation of the "Copy of ..." partition to shrink, compaired to
the actual partition on disk.  This also adds "unallocated" partitions
on either side to the display.  I presume this depends on the alignment
of the partitions on disk as it only occurs on one of my machines.  Seen
with GParted 0.7.0 and the latest GIT HEAD GPARTED_0_12_0-20-g8f7054b.
Comment 1 Mike Fleetwood 2012-03-22 20:57:45 UTC
# fdisk -l -u /dev/sda

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000b3a78

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          63     1044224      522081   83  Linux
/dev/sda2         1044225    11550734     5253255   82  Linux swap / Solaris
/dev/sda3        11550735    64002959    26226112+  83  Linux
/dev/sda4        64002960   976768064   456382552+   5  Extended
/dev/sda5        64003023   483444044   209720511   83  Linux
/dev/sda6       483446093   487640396     2097152   83  Linux
/dev/sda7       487642445   491836748     2097152   83  Linux
/dev/sda8       491838797   496033100     2097152   83  Linux
/dev/sda9       496035149   500229452     2097152   83  Linux
/dev/sda10      500231501   504425804     2097152   8e  Linux LVM
/dev/sda11      504427853   508622156     2097152   8e  Linux LVM
/dev/sda12      508624205   512818508     2097152   8e  Linux LVM
/dev/sda13      512820557   722535756   104857600   83  Linux
/dev/sda14      722537805   953224524   115343360   83  Linux
Comment 2 Mike Fleetwood 2012-03-22 21:25:28 UTC
Operation performed is copy of partition sda13 and paste on to sda14.

Fragments of my debugging output:

D: Win_Gparted::active_paste()
D:  selected_partition.get_path() ="/dev/sda14"
D:                    .device_path="/dev/sda"
D:                    .label      =""
D:                    .status     =0 (STAT_REAL)
D:                    .alignment  =1 (ALIGN_MEBIBYTE)
D:                    .sector_start       =722537805
D:                    .sector_end         =953224524
D:                    .get_sector_length()=230686720
D:                    .sectors_used       =-1
D:                    .sectors_unused     =-1
D:                    .sectors_unallocated=0
D:                    SUM(sectors_*)      =-2
D:  partition_new.get_path() ="/dev/sda14"
D:               .device_path="/dev/sda"
D:               .label      ="btrfs-test"
D:               .status     =0 (STAT_REAL)
D:               .alignment  =1 (ALIGN_MEBIBYTE)
D:               .sector_start       =722537805
D:               .sector_end         =953224524
D:               .get_sector_length()=230686720
D:               .sectors_used       =56
D:               .sectors_unused     =104857544
D:               .sectors_unallocated=125829120
D:               SUM(sectors_*)      =230686720
D: GParted_Core::snap_to_mebibyte() device="/dev/sda" partition="copy of /dev/sda13"
D:  partition.sector_start       =722537805
D:           .sector_end         =722537805
D:           .get_sector_length()=230686720
D:  diff=1357
D:  partition.sector_start=722538496
D:  diff=1357
D:  partition.sector_end=953223167
D:  partition.sector_start       =722538496
D:           .sector_end         =722538496
D:           .get_sector_length()=230684672
D:  PARTITION CHANGED SIZE !
Comment 3 Mike Fleetwood 2012-03-23 18:13:28 UTC
Created attachment 210458 [details] [review]
GParted partition alignment uninitialised read patch

Hi Curtis,

Here's the fix.  It's another uninitialised variable.  Partition object
.alignment this time.

The change to Win_GParted::activate_paste() is the minimal fix, but I
also initialised .alignment when all partition objects are created in
Partition::Reset() so we don't have uninitialised variable waiting to
bite.

Mike
Comment 4 Curtis Gedak 2012-03-24 16:56:15 UTC
Thank you Mike for identifying this problem and for providing a patch to address it.

This patch has been committed to the GNOME git repository for inclusion in the next release of GParted.

The relevant git commit can be viewed at the following link:

Fix uninitialised read when pasting into an existing partition
http://git.gnome.org/browse/gparted/commit/?id=ea4b77eb01a1e1357ab3ef89a2e7f46a20504fd1
Comment 5 Curtis Gedak 2012-04-09 20:14:41 UTC
The enhancements for this bug report have been included in GParted 0.12.1 released on April 9, 2012.