Split the resizing file system and resizing partition calls in
GParted_Core::resize() into separate grow and shrink code paths.
Note that this also changes the degenerative case of calling resize()
when the partition isn't changing size, for non-swap partitions, from a
file system check step to a successful no-op. This doesn't matter as my
testing never found resize() to be called when the partition isn't
changing size.
Also correct spelling of local variable success.
Bug 741211 - Remove unnecessary duplicate actions when resizing a
partition
Shrinking swap partition operation performs these steps:
Shrink /dev/sdb2 from 2.00 GiB to 1.00 GiB
+ calibrate /dev/sdb2
+ check file system on /dev/sdb2 for errors and (if possible) fix them
checking is not available for this file system
+ shrink file system
+ create new linux-swap file system
+ mkswap -L "test-swap" -U "bd381eba-5df7-42e2-8e0e-411e9701c995" /dev/sdb2
+ shrink partition from 2.00 GiB to 1.00 GiB
+ create new linux-swap file system
+ mkswap -L "test-swap" -U "bd381eba-5df7-42e2-8e0e-411e9701c995" /dev/sdb2
Resizing a linux-swap partition was partially special cased in
GParted_Core::resize(). Make it fully special cased so that it just
does the following steps. No more skipped file system checks or extra
resizing.
1) Resize partition,
2) Recreate linux-swap.
This existing call chain recreates the linux-swap:
GParted_Core::resize_filesystem()
linux_swap::resize()
A compound move and resize operation still performs unnecessary checks
and recreates of linux-swap, but less than before.
Bug 741211 - Remove unnecessary duplicate actions when resizing a
partition
Shrinking a partition performs a single file system check step, but
growing a partition still performs two file system checks.
Grow /dev/sda8 from 1.00 GiB to 10.00 GiB
+ calibrate /dev/sda8
+ check file system on /dev/sda8 for errors and (if possible) fix them
+ grow partition from 1.00 GiB to 10.00 GiB
+ check file system on /dev/sda8 for errors and (if possible) fix them
+ grow file system to fill the partition
This is a leftover from the early days of GParted when resizing a
partition used cylinder buffering and performed three file system
checks. See prior to commit:
d663c3c277
removed cylindersize buffering during resize from the filesystems.
Remove the second file system check when growing a partition.
Bug 741211 - Remove unnecessary duplicate actions when resizing a
partition
First use of PKG_CHECK_EXISTS causes additional checking messages to be
reported which splits the libparted version check message from it's
result, like this:
checking for libparted >= 1.7.1 (querying pkg-config)... checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
2.3
Call PKG_CHECK_EXISTS early, before first use to avoid this. Output
now looks like:
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
:
checking for libparted >= 1.7.1 (querying pkg-config)... 2.3
Bug 740004 - use pkg-config to check for version of libparted
Currently ./configure links and runs a program to query the libparted
library version, which is used to determine the availability of some
features. This makes cross-compiling harder because the compile host
has to fake a virtual installation target in which to run the check.
Because of this, pkg-config based Autoconf checks are preferred.
Switch to using a pkg-config based Autoconf check first to determine the
version of libparted, falling back to the previous method for older
distributions which don't provide a pkg-config file for libparted.
Also small comment tidy-up elsewhere.
Bug 740004 - use pkg-config to check for version of libparted
Simplify how the list of file system types is populated in the Create
New Partition dialog. Change from copying everything and removing
unwanted items to only copying required items. Makes the code simpler
and therefore easier to understand.
Only recognises ReFS file system. No other actions are supported.
Requires blkid from util-linux >= 2.24.
Bug #738471 - ReFS file system is not recognised
Use GParted_Core::supported_filesystem() to remove the need to
explicitly list the growing number of recognised, but otherwise
unsupported, file system signatures in multiple places.
Bug #738471 - ReFS file system is not recognised
Helper to check whether a recognised file system type is supported by
GParted or not. Supported means there is an implementation class and
will appear in the File System Support dialog.
Make supported_filesystem() a static member function so that it can be
called without a class object so that GParted_Core::GParted_Core()
initialiser isn't called multiple times. This requires FILESYSTEM_MAP
to become a static member variable too.
Bug #738471 - ReFS file system is not recognised
get_filesystem_object() takes a constant reference to a FILESYSTEM, but
FILESYSTEM is just an enumeration. So that's a pointer to a constant
int. Just pass by value instead.
RHEL / CentOS 5.6 and later officially support ext4 file system [1].
From RHEL / CentOS 5.3 ext4 file system was included as a technology
preview. Ext4 file system tools are in a separate package e4fsprogs,
using uniquely named commands. The standard e2fsprogs commands only
support ext2 and ext3 file systems.
# mkfs.ext4 /dev/sdb3
# tune2fs -l /dev/sdb3
tune2fs 1.39 (29-May-2006)
tune2fs: Filesystem has unsupported feature(s) while trying to open /dev/sdb3
Couldn't find valid filesystem superblock.
# echo $?
1
# tune4fs -l /dev/sdb3
tune4fs 1.41.12 (17-May-2010)
Filesystem volume name: <none>
Last mounted on: <not available>
Filesystem UUID: ba4a9d58-7728-4b47-8a90-80e772615637
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: has_journal ext_attr resize_inode dir_index filetype extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
...
For ext4 only, search for the e4fsprogs specific commands first and the
standard e2fsprogs commands second.
[1] RHEL 5.6 Release Notes, 5. Filesystems and Storage
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/5.6_Release_Notes/ar01s05.html
Bug #738706 - GParted doesn't support ext4 on RHEL/CentOS 5.x
Automatic selection of the largest unallocated partition caused flashing
redraw of the partition graphic and partition list. Both the partition
graphic and partition list were being drawn blank then redrawn fully
populated. This only happened on some distributions including:
CentOS 5.10, 6.5, 7.0, Debian 6, Fedora 14, 20, Xubuntu 14.04 LTS. Did
not happen on: Kubuntu 12.04 LTS.
This is a workaround, not a complete fix. It moves automatic selection
of the largest unallocated partition to after processing of the GTK
Event loop in Refresh_Visual() which redraws the partition graphic and
partition list. These visuals are now drawn only once, fully populated,
however this draws them without the selected partition. The partition
selection is then drawn afterwards which causes the selection to flash
instead. This is significant improvement to the whole partition graphic
and partition list flashing when redrawn.
Bug #696149 - Double refresh of display introduced with default
unallocated space
The device combobox was getting drawn blank, then getting drawn again
with the selected device. This was happening because at the start of
Win_GParted::refresh_combo_devices() the GTK model behind the combobox,
liststore_devices, was cleared, changing the active item, causing the
combobox to get redrawn empty. After the GTK model had been repopulated
the active item was reset causing the comboxbox to get redrawn again,
now showing the selected device. Call flow:
Win_GParted::refresh_combo_devices()
liststore_devices->clear()
//Gtk::Combobox emits signal_change. Registered callbacks
//called.
Win_GParted::combo_devices_changed()
Win_GParted::Refresh_Visual()
...
...
combo_devices.set_active(current_device);
//Gtk::Combobox emits signal_change. Registered callbacks
//called.
Win_GParted::combo_devices_changed()
Win_GParted::Refresh_Visual()
...
This has always been the case, since the device combobox was first added
to GParted before version 0.1 by commit:
3a4b43e0ad
replaced deprecated OptionMenu with ComboBox ...
Fix by temporarily blocking the devices comboxbox from emitting
signal_changed while the GTK model behind the combobox is recreated.
However, since automatic selection of the largest free space was added
[1] in GParted 0.15.0, a more noticeable flashing redraw issue was
caused in which the partition graphic and partition list were both drawn
blank then redrawn fully populated. Some distributions were not
affected by this at all, some only experienced a single flash and others
suffered from two or more flashing redraws. Some affected
distributions: CentOS 5.10, 6.5, 7.0, Debian 6, Fedora 14, 19, 20,
Ubuntu 13.10, Xubuntu 14.04 LTS. Did not occur on Kubuntu 12.04 LTS.
[1] 5b53c12f6e
Select largest unallocated partition by default (#667365)
Bug #696149 - Double refresh of display introduced with default
unallocated space
CPPFLAGS - Needed to instruct the compiler to use libparted include
files, <parted/parted.h> etc, from the non-default location.
LD_LIBRARY_PATH - Not needed to specify an additional directory to find
libparted shared libraries at run time, as the linker build the
additional directory into the executable based on the LD_RUN_PATH
environment variable.
Automake 1.13 and later generates the following warning when building
GParted from git:
$ ./autogen.sh
...
checking for automake >= 1.9...
testing automake-1.13... found 1.13.4
...
Running automake-1.13...
src/Makefile.am:1: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
...
INCLUDES name has been depreciated since automake 1.7. GParted's
autogen.sh and configure.ac require at least automake 1.9. Therefore
replace automake variable INCLUDES with AM_CPPFLAGS.
Bug #735742 - automake warns INCLUDES is deprecated
Use AC_ARG_ENABLE() and AS_HELP_STRING() macros to improve handling of
the --disable-doc option.
Change the names, and sence, of the Autoconf and Automake definitions
used to control building of the help documentation. Reasons are:
(1) Switch from negative to positive statements which are more natural
to comprehend.
(2) Insert HELP in the names from *_DOC to *_HELP_DOC as they control
building of the documentation in the help subdirectory, not the
manual page in the doc directory.
Autoconf: HAVE_DISABLE_DOC -> ENABLE_HELP_DOC
Automake: DISABLE_DOC -> BUILD_HELP_DOC
Bug #734076 - Autodetect parted online partition resizing capability
Use AC_ARG_ENABLE() Autoconf macro to set enable_libparted_dmraid
variable to either yes or no in all cases, whether set on the command
line or not. Use AS_HELP_STRING() macro to format the option help text.
Bug #734076 - Autodetect parted online partition resizing capability
Configure script checks for libparted version >= 3.2 to automatically
determine the availability of online resize capability in libparted.
This can be overridden from the ./configure command line. Override
enable when an older version of libparted has been patched to include
online resize support with:
./configure --enable-online-resize
Override disable with libparted 3.2 or later to disable the feature when
it is not wanted with:
./configure --disable-online-resize
Note that GParted also requires, and checks for at runtime, Linux
kernel >= 3.6 for online resize support. See commit for more details:
de2844d02d
Add online resize support (#694622)
Bug #734076 - Autodetect parted online partition resizing capability
Currently -lparted is passed to the linker by being hard coded in the
gpartedbin_LDFLAGS variable in src/Makefile.am and -lparted-fs-resize
by conditionally being appended to the gpartedbin_LDFLAGS.
Add an Autoconf AC_CHECK_LIB check for the parted library using it's
default action-if-found to extend LIBS. Update the existing
AC_CHECK_LIB check for the parted-fs-resize library so that the
overridden action-if-found also extends LIBS with -lparted-fs-resize.
These libraries are then assigned via the LIBS variable in the
generated Makefiles.
This matches how the other libraries, dl and uuid, were found in the
configure script and passed to the Makefiles.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
Configure.ac still builds and runs very similar test executables twice
to determine in the version of libparted is >= minimum require 1.7.1 and
2.2 for improved partition re-read code.
Build and run a single test to determine the version of libparted and
cache the result. Use this cached version number when testing the
version of libparted. Inspired by the version checking for intltool
from /usr/share/aclocal/intltool.m4.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
If ped_file_system_resize() function is found in the parted library
don't bother to go on to check for it in the parted-fs-resize library.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
Remove HAVE_LIBPARTED_2_2_0_PLUS definition
Rename version specific #define HAVE_LIBPARTED_2_2_0_PLUS into two
separate feature specific names set as required:
Name Set when?
ENABLE_PT_REREAD_WORKAROUND (libparted < 2.2)
USE_LIBPARTED_LARGE_SECTOR_SUPPORT (libparted >= 2.2)
Using feature specific #defines is the standard Autoconf way and makes
the resultant conditional code easier to understand. Still have to
check the version of libparted though.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
Replace Autoconf check for libparted >= 3.0
Currently uses a custom check which compiles an executable to check for
libparted version >= 3.0 to determine if the ped_file_system_resize()
function exists in the parted library.
Change to use a direct Autoconf check to determine the availability of
the ped_file_system_resize() function in the parted library.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
Remove HAVE_LIBPARTED_3_0_0_PLUS definition
The #define only controls whether fat16 and fat32 file systems are moved
by libparted (for versions <= 2.4) or the GParted internal algorithm
(for libparted versions >= 3.0). See this commit for more details:
0fda1d011d
Enable new fs resize library available with parted-3.1 (#668281)
As nearly all other file system are moved using the GParted internal
algorithm, just always use it to move fat16 and fat32 file systems too.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
Remove HAVE_LIBPARTED_3_1_0_PLUS definition and replace Autoconf
check for libparted >= 3.1
Currently uses custom check which compiles an executable to check for
libparted version >= 3.1 to determine the availability of the library
parted-fs-resize and the need to include the header <parted/filesys.h>.
Change to use a direct Autoconf check to determine the availability of
the ped_file_system_resize() function in the parted-fs-resize library.
Remove inclusion of the header <parted/filesys.h> as it has always been
included via <parted/parted.h>, at least as far back as parted 1.8.0,
and even in parted 3.0 when ped_file_system_resize() and libparted file
system resize capability didn't exist.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones
AM_PROG_LIBTOOL is an old name and alias for AC_PROG_LIBTOOL. Update.
NOTE:
In turn AC_PROG_LIBTOOL is an old name and alias for LT_INIT, but
CentOS 5.x with libtool 1.5.22 doesn't have LT_INIT defined in
/usr/share/aclocal/libtool.m4 serial 48, only AC_PROG_LIBTOOL and
AM_PROG_LIBTOOL. Therefore only update to AC_PROG_LIBTOOL and not
LT_INIT while CentOS 5.x is supported.
Bug #734718 - Update Autoconf version specific libparted checks and
defines to feature specific ones