Check disks named on the command line are safe to use too (#755495)
When probing for disk devices GParted ensures that libparted is capable of handling the sector size safely and that it is a real disk before it is shown in the UI. However when disk devices are named on the command line none of these checks are performed. Libparted versions before v2.2 can only safely handle a sector size of 512 bytes. Therefore on old distributions with libparted < v2.2 GParted allows unsafe editing of disk devices with larger sector sizes when they are named on the command line. Known to affect these distributions: RedHat/CentOS 5 (parted 1.8.1) RedHat/CentOS 6 (parted 2.1) For example (on CentOS 6.5) large sector disk device is ignored when probing: # modprobe scsi_debug dev_size_mb=128 sector_size=4096 # fgrep scsi_debug /sys/block/*/device/model /sys/block/sdd/device/model:scsi_debug # gparted ====================== 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. However when the device is named it is not ignored and can be edited: # gparted /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 Apply the same validity checks to disk devices named on the command line as to probed ones. Bug 755495 - GParted allowing partitioning of large sector devices specified on the command line, when built with old libparted which doesn't support it
This commit is contained in:
parent
037020b116
commit
362b2db331
|
@ -225,22 +225,32 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
|
|||
|
||||
std::sort( device_paths .begin(), device_paths .end() ) ;
|
||||
}
|
||||
#ifndef USE_LIBPARTED_DMRAID
|
||||
else
|
||||
{
|
||||
//Device paths were passed in on the command line.
|
||||
|
||||
//Ensure that dmraid device entries are created
|
||||
for ( unsigned int t = 0 ; t < device_paths .size() ; t++ )
|
||||
{
|
||||
set_thread_status_message( String::ucompose( _("Confirming %1"), device_paths[t] ) );
|
||||
|
||||
#ifndef USE_LIBPARTED_DMRAID
|
||||
// Ensure that dmraid device entries are created
|
||||
if ( dmraid .is_dmraid_supported() &&
|
||||
dmraid .is_dmraid_device( device_paths[t] ) )
|
||||
{
|
||||
dmraid .create_dev_map_entries( dmraid .get_dmraid_name( device_paths [t] ) ) ;
|
||||
}
|
||||
#endif
|
||||
|
||||
PedDevice* lp_device = ped_device_get( device_paths[t].c_str() );
|
||||
if ( lp_device )
|
||||
{
|
||||
if ( ! useable_device( lp_device ) )
|
||||
// Remove this disk device which isn't useable
|
||||
device_paths.erase( device_paths.begin() + t );
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for ( unsigned int t = 0 ; t < device_paths .size() ; t++ )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue