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 755495 - GParted allowing partitioning of large sector devices specified on the command line, when built with old libparted which doesn't support it
GParted allowing partitioning of large sector devices specified on the comman...
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: 2015-09-23 19:11 UTC by Mike Fleetwood
Modified: 2015-10-27 17:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Validate command line named disk devices (v1) (11.01 KB, patch)
2015-10-06 19:07 UTC, Mike Fleetwood
none Details | Review

Description Mike Fleetwood 2015-09-23 19:11:27 UTC
When GParted is built with an old version of libparted (pre version 2.2
which doesn't support large sector drives) it it meant to ignore drives
with sector sizes greater than 512 bytes.  However it only ignores such
drives when scanning for drives, not when they are specified on the
command line.

Effects at least these still supported distributions with old versions
of libparted:
* RHEL/CentOS 6 with libparted 2.1
* RHEL/CentOS 5 with libparted 1.8.1



Correctly ignoring when scanning:

[root@centos6 ~]# modprobe scsi_debug dev_size_mb=128 sector_size=4096
[root@centos6 ~]# ~centos/bin/gpartedbin-0.23.0
======================
libparted : 2.1
======================
Device /dev/sdd has a logical sector size of 4096.  Not all parts of GNU Parted support this at the moment, and the working code is HIGHLY EXPERIMENTAL.

Ignoring device /dev/sdd with logical sector size of 4096 bytes.
GParted requires libparted version 2.2 or higher to support devices with sector sizes larger than 512 bytes.



Incorrectly allowing operation on large sector drive when specified on
the command line:

[root@centos6 ~]# ~centos/bin/gpartedbin-0.23.0 /dev/sdd
======================
libparted : 2.1
======================
Device /dev/sdd has a logical sector size of 4096.  Not all parts of GNU Parted support this at the moment, and the working code is HIGHLY EXPERIMENTAL.

/dev/sdd: unrecognised disk label
Comment 1 Mike Fleetwood 2015-10-06 19:07:56 UTC
Created attachment 312753 [details] [review]
Validate command line named disk devices (v1)

Hi Curtis,

Here's the patchset for this.

So if a user does specific just one device on the command line which is
a large sector device and libparted is too old to handle it, there will
be a message on the console reporting the device ignored, as seen in
comment 1 above, and the GParted UI will show "No devices detected" in
the status bar.

In the end I didn't do as much refactoring as I suggested I might do, to
Wrolf in bug 755429 comment 3.  Further refactoring of
set_devices_thread() belongs under that bug not this.  I'll do that
refactoring and post it into bug 755429.

Thanks,
Mike
Comment 2 Curtis Gedak 2015-10-09 16:12:42 UTC
Hi Mike,

Good catch on the difference in handling between GParted auto-determining devices and when device paths are passed on the command line.  I hadn't even thought of a user passing the same device path twice.

I tested patch set v1 on Kubuntu 12.04 and also Fedora 13 (had parted 2.1) and all went well.

Patch set v1 from 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:

Create new method GParted_Core::useable_device() (#755495)
https://git.gnome.org/browse/gparted/commit/?id=037020b1162a2d61576fb80fdea54522533c93f1

Check disks named on the command line are safe to use too (#755495)
https://git.gnome.org/browse/gparted/commit/?id=362b2db331b4c31a978bb67232fa7f3ce9ab38c3

Sort command line named disk devices and remove duplicates (#755495)
https://git.gnome.org/browse/gparted/commit/?id=3d3d98994bd1b3fc56260b65e576cf0f8d6a50ea

Ensure DMRaid /dev entries are created before using named devices
https://git.gnome.org/browse/gparted/commit/?id=23b5ba4e4e45a384038f6c25a94715d1ff733a79

Thanks,
Curtis
Comment 3 Curtis Gedak 2015-10-27 17:04:28 UTC
This enhancement was included in the GParted 0.24.0 release on October 27, 2015.