Having a member variable named 't' which is used to share state in a
Dialog_Progress object between on_signal_show() and on_cancel() methods
is horrible. Rename to something more meaningful.
Also initialise m_curr_op in the constructor's initialisation list,
rather than later when first used in on_signal_show(). Not strictly
required, but avoids this POD (Plain Old Data) member variable being
undefined in the Dialog_Progress object between construction and when
on_signal_show() previously assigned to it for the first time and
started using it.
* C++ FAQ / Should my constructors use "initialization lists" or
"assignment"?
https://isocpp.org/wiki/faq/ctors#init-lists
Writes the starting device overview information of all known devices to
the top of the saved details HTML. This is so that hopefully we don't
need to additionally ask users for their disk layouts via 'fdisk -l',
'parted print' and 'lsblk' when the saved details file is provided.
Also moves the equals separators "==================" from below to
above each operation so the each section is separated.
Bug 639176 - Save partition layout to gparted_details.htm
Some icon themes only provide large icons for stock items. This can
cause problems like overly large icons appearing in the GParted UI.
Found on Kubuntu 16.04 LTS with default breeze icon theme.
Be compatible with these icon themes by forcing scaling of stock icons
to the requested size.
Icons are used either by Gtk::Image widgets, or Gtk::CellRendererPixbuf
objects for comboboxes/treeviews. For Gtk::Image widgets we add
Utils::mk_image() that constructs Gtk::Image widgets and then sets the
pixel-size property. For Gtk::CellRendererPixbuf we add
Utils::mk_pixbuf() that first loads a Gdk::Pixbuf and then scales if
needed.
Closes#39 - After GTK3 port icons are too big on KDE
- Back in Fedora 22 the distribution switched from using yum to dnf for
package installation, while CentOS / RHEL continues to use yum.
Separate out package instructions.
- Update package dependencies for what is required on current versions
of the documented distributions.
To further help in diagnosing root authorisation issues by reporting the
error message to the terminal too. Also set a failure exit status when
terminating with this error.
Example:
$ ./gpartedbin
GParted 0.33.0-git
configuration --enable-online-resize
libparted 3.2
Root privileges are required for running GParted
$ echo $?
1
Closes!34 - Display more version and configuration information
So that the new version and configuration information is displayed even
if the gpartedbin executable is run as a non-root user. To help with
diagnosing root authorisation issues with the gparted shell wrapper
script.
Closes!34 - Display more version and configuration information
For consistency save the 3 same lines of information into the saved
operation details. None of the new 3 lines are subject to translation.
As this information is really for our benefit when supporting users
leaving them as English is OK. Also "GParted" and "Libparted", as
previously used, are proper nouns so they were never changed as part of
any language translation. See with:
egrep -r '"(GParted|Libparted)"' po/
Closes!34 - Display more version and configuration information
So that we might get more information from users when helping them.
Starting GParted from the command line now looks like this:
# ./gpartedbin
GParted 0.33.0-git
configuration --enable-online-resize
libparted 3.2
Closes!34 - Display more version and configuration information
Running GParted on AltLinux with dmraid installed but with no configured
RAID arrays produces this error:
# gparted
...
Could not stat device /dev/mapper/No RAID disks - No such file or directory.
Most distributions use dmraid 1.0.0.rc16 which reports no raid disks
like this:
# dmraid -sa -c
no raid disks
# echo $?
1
However AltLinux had the slightly older version, dmraid 1.0.0.rc14,
which reported no raid disks like this:
# dmraid -sa -c
No RAID disks
# echo $?
0
So because dmraid 1.0.0.rc14 reported success, exit status 0, and the
"No RAID disks" message was not in lower case, that text was considered
a disk device in a DMRaid array. Fix by checking for "no raid disks" in
any case.
Bug 786031 - Could not stat device /dev/mapper/No RAID disks - No such
file or directory
Glibmm has implemented a ustring::compose() set of methods [1] since
Glibmm 2.16, circa 2008. So replace String::ucompose(). Note that
GParted already requires glibmm >= 2.32 as set in configure.ac.
This commit just replaces all the method calls. Edit created by:
sed -i 's|String::ucompose *|Glib::ustring::compose|' src/*.cc
[1] Glibmm Reference Manual, Glib::ustring Class, compose() method
https://developer.gnome.org/glibmm/2.32/classGlib_1_1ustring.html#a64ff7ac3d9e9899c2910f1d831f8d500Closes#46 - Drop compose subdir
Fix to make mkfs.f2fs properly handle labels longer than 16 characters
was included in f2fs-tools 1.2.0 [1]. The oldest supported
distributions now include this release:
Distro EOL f2fs-tools
- Debian 8 2020-Jun 1.4.0
- RHEL / CentOS 7 2024-Jun 1.4.1
- SLES 12 2027-Oct Unknown
- Ubuntu 14.04 LTS 2019-Apr 1.2.0
Note that on Ubuntu 14.04 LTS blkid from util-linux 2.20.1 is too old to
recognise F2FS file systems, as 2.23 is required for F2FS support [2].
mkfs.f2fs claims the maximum label length is less than 512 characters,
but actually accepts 512 characters.
# label=`head -c 1024 < /dev/zero | tr '\0' 'A'`
# mkfs.f2fs -l `echo -n "$label" | cut -c1-513` /dev/sdb10
F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)
Error: Volume Label should be less than 512 characters
Usage: mkfs.f2fs [options] device [sectors]
[options]:
-a heap-based allocation [default:1]
-d debug level [default:0]
-e [extension list] e.g. "mp3,gif,mov"
-l label
-o overprovision ratio [default:5]
-s # of segments per section [default:1]
-z # of sections per zone [default:1]
-t 0: nodiscard, 1: discard [default:1]
sectors: number of sectors. [default: determined by device size]
# echo $?
1
# mkfs.f2fs -l `echo -n "$label" | cut -c1-512` /dev/sdb10
F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)
Info: Label = AAAAAAAAAAAA...[trimmed from 512 "A"s]...AAAAAAAAAAAA
Info: sector size = 512
Info: total sectors = 1048576 (in 512bytes)
Info: zone aligned segment0 blkaddr: 256
Info: Discarding device
Info: This device doesn't support TRIM
Info: format successful
# echo $?
0
# blkid -V
blkid from util-linux 2.25.2 (libblkid 2.25.0, 24-Oct-2014)
# blkid /dev/sdb
/dev/sdb10: LABEL="AAAAAAAAAAAA...[only 127 "A"s]...AAAAAAAAAAAA"
UUID="f47f3fdc-dd91-4616-bb6d-0d643a884265" TYPE="f2fs"
PARTUUID="3bb4bef8-9494-4e82-8dda-5d8edd9c60d9"
As blkid only reports the first 127 characters and is the only command
used for reading the label of an F2FS file system, use this as the new
increased limit.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=9799d6364dc93e1fd259d812d4a50ed984a6456b
mkfs: handle labels longer than 16 characters
[2] https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.23/v2.23-ReleaseNotes
"add Flash-Friendly File System (f2fs) support [Alejandro Martinez
Ruiz]"
Closes!29 - Enhance F2FS support
On CentOS 7 with f2fs-tools 1.4.1, checking an F2FS file system fails
like this:
# fsck.f2fs -f -y -a /dev/sdb3
Info: Force to fix corruption
fsck.f2fs: invalid option -- 'y'
Error: Unknown option ?
Usage: fsck.f2fs [options] device
[options]:
-a check/fix potential corruption, reported by f2fs
-d debug level default:0]
-f check/fix entire partition
-t show directory tree [-d -1]
# echo $?
1
Turns out that the '-y' option was not available until f2fs-tools 1.10.0
and is identical to the existing '-f' option anyway [1], which GParted
already uses. Just remove the '-y' option passed to fsck.f2fs.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=55ee9e7202f84168f868d863da8ed1c4995a0e6d
fsck.f2fs: add -y for generic fsck
Closes!29 - Enhance F2FS support
Before this commit [1] first included in f2fs-tools 1.5.0, dump.f2fs
didn't report the total space used by the file system. This causes F2FS
file system usage not be reported on older distributions, including
RHEL/CentOS 7 and Debian 8.
On CentOS 7:
# rpm -q f2fs-tools
f2fs-tools-1.4.1-2.el7.nux.x86_64
# dump.f2fs -d 1 /dev/sdb3 | egrep 'sector size =|total.*sectors ='
Info: sector size = 512
Info: total sectors = 2097152 (in 512 bytes)
On Fedora 28:
# rpm -q f2fs-tools
f2f2-tools-1.10.0-1.fc28.x86_64
# dump.f2fs -d 1 /dev/sdb2 | egrep -a 'sector size =|total.*sectors ='
Info: sector size = 512
Info: total sectors = 3145728 (1536 MB)
Info: total FS sectors = 2621440 (1280 MB)
"total sectors" reports the size of the partition.
"total FS sectors" reports the size of the file system.
Cope with the file system size being missing. Pass -1 as the file
system size to partition.set_sector_usage() in this case. Note that
this means GParted won't be able to detect and report unallocated space
within the partition when using f2fs-tools < 1.5.0.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=fea6162a6db9af527648262d9fbb0335a0cc5460
fsck.f2fs: show total sectors consumed by filesystem
Closes!29 - Enhance F2FS support
On Fedora 28 with f2fs-tools 1.10.0, dump.f2fs is producing NUL
characters in it's output and this completely breaks the parsing code in
f2fs::set_used_sectors(). Glib::Regex, as used by
Utils::regexp_label(), just doesn't match any text after the first NUL
character from the output.
# dump.f2fs -d 1 /dev/sdb1
Info: Debug level = 1
Info: [/dev/sdb1] Disk Model: VBOX HARDDISK 1.0 ^@^@^@^@^@^@^@^...
Info: Segments per section = 1
Info: Sections per zone = 1
Info: sector size = 512
Info: total sectors = 2097152 (1024 MB)
...
Grep thinks the output is binary too:
# dump.f2fs -d 1 /dev/sdb1 | \
> egrep 'valid_block_count|user_block_count|log_blocksize|sector size =|total FS sectors ='
Binary file (standard input) matches
# dump.f2fs -d 1 /dev/sdb1 | \
> egrep --text 'valid_block_count|user_block_count|log_blocksize|sector size =|total FS sectors ='
Info: sector size = 512
log_blocksize [0x c : 12]
Info: total FS sectors = 2097152 (1024 MB)
user_block_count [0x 36400 : 222208]
valid_block_count [0x 2 : 2]
Re-write set_used_sectors() using string find() and sscanf() to be
similar to how a number of the other set_used_sectors() are written for
other file systems.
Closes!29 - Enhance F2FS support
Now that GParted requires Gtk3 there is no need to use floating point
numbers for compatibility with Gtk <= 2.22. Replace with symbolic
alignment constants.
Relevant commit history:
* 6efa623401
Add optional yalign argument to Utils::mk_label() method
* be2689ad25
Stop using deprecated widget alignment enumerators (#652044)
btrfs-progs 3.12 includes 'btrfs filesystem label /dev/PTN NEWLABEL'
functionality so stop checking for this before enabling setting the
label.
$ btrfs version
Btrfs v3.12
$ btrfs filesystem label --help
usage: btrfs filesystem label [<device>|<mount_point>] [<newlabel>]
Get or change the label of a filesystem
With one argument, get the label of filesystem on <device>.
If <newlabel> is passed, set the filesystem label on <newlabel>.
$ echo $?
0
Worst case scenario is that some how an old version of the btrfs command
is used which doesn't support the labelling functionality. Then this
commit would change GParted from disallowing labelling of a btrfs, to
allowing it, but presumably it would fail with an error from the btrfs
command reporting so. Arguably better from a support point of view.
Closes!26 - Remove support for btrfs-progs < 3.12
This commit [1] from btrfs-progs 3.12 removed the previously deprecated
programs btrfsctl and btrfs-show. As btrfs-progs 3.12 is now the
minimum requirement, remove support for those removed programs.
This commit is just removing the use of btrfs-show as a fallback to read
the label.
Note that 'btrfs-show /dev/PTN' didn't distinguish between a label of
"none" and no label. Hence the logic in btrfs::read_label() to do with
matching the label "none", or matching the label with or without single
quotes. Unfortunately as identified in this commit [2]
'btrfs filesystem show /dev/PTN' is subject to the same issue, but only
when the file system is mounted and only for btrfs-progs 3.12. This was
fixed by this commit [3] from btrfs-progs 3.14.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=f243fcd1b2aa55ffadfbcc032c66dedbee56e79e
Removing btrfsctl, btrfs-vol, btrfs-show
[2] eca732fb0c
Update parsing of btrfs filesystem show for the label (#733601)
[3] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=a156b967ed9bd606afa8dc402451abcf07226c17
btrfs-progs: make filesystem show by label work
Closes!26 - Remove support for btrfs-progs < 3.12
PATCHSET OVERVIEW
The oldest supported distributions have these versions of the Linux
kernel and btrfs-progs:
Distro EOL kernel btrfs-progs
- RHEL / CentOS 7 2024-Jun 3.10.0 4.9.1
- Ubuntu 14.04 LTS 2019-Apr 4.4.0 3.12
- Debian 8 2020-Jun 3.16.0 3.17
- SLES 12 2027-Oct 3.12.28 3.16
Making the oldest supported packages be kernel 3.10 and btrfs-progs 3.12
allows the btrfs support code to be simplified by removing backward
compatibility.
THIS CHANGE
Remove old workaround for ignoring the error when resizing a btrfs to
the same size on Linux kernel < 3.2.
Also now that only exit status 0 is considered successful from btrfs
resize, the EXEC_CHECK_STATUS flag to execute_command() can be used,
rather than having to separately call set_status() afterwards.
Relevant commit history:
* 11d044dba0
Don't ignore any errors resizing btrfs on Linux >= 3.2 (#669389)
* a580abbc30
Use newer btrfs multi-tool control command first
Closes!26 - Remove support for btrfs-progs < 3.12
The title has never been set in this case, and defaulted to the name of
the executable 'gpartedbin'. Fix this.
Closes#44 - Title not set in Resize/Move dialog for extended partitions
'launched' local POD (Plain Old Data) variable was left uninitialised,
but was set in both the try and catch clauses. Best practice is to
initialise when defined, so do that instead. Cosmetic change.
It is not creating a dialog (a pop-up window managed by GParted code
itself). It is launching independent yelp program to display the help,
so remove the "_dialog" from the name to avoid any possible confusion.
Originally, if the yelp command was not installed, attempting to display
help produced an error dialog with this message:
Failed to execute child process "yelp" (No such file or directory)
However since this commit during the Gtk 3 port [1] the error message
became this less useful one:
Operation not supported
Two attempts are made to display the GParted Manual, first using
gtk_show_uri() and second by executing the yelp command directly. Prior
to the aforementioned commit [1] both methods returned the failure
reason using the same 'error' variable. Hence reported the message
"Failed to execute child process "yelp" ..." from the second attempt.
However that commit had to re-code the second method as part of the Gtk
3 port and use a different error returning mechanism, thus the use of
different variable 'e'. But the dialog was left reporting the message
from the original 'error' variable, thus reporting "Operation not
supported" message from the first attempt using gtk_show_uri().
Fix by again displaying the message from the second failure into the
error dialog. Also make it very clear there are two error returning
variables by naming them 'error1' and 'error2_msg'.
[1] 2953778a4c
port-to-gtk3: Use Gdk::AppLaunchContext to launch yelp (#7)
Use of PKG_NAME is deprecated in GNOME 3 and produced this warning:
$ ./autogen.sh
/usr/bin/gnome-autogen.sh
/usr/bin/yelp-build
***Warning*** PKG_NAME is deprecated, you may remove it from autogen.sh
...
Now that GParted is a GNOME 3 application with GNOME 3 yelp-tools
managed documentation this is redundant and can be removed. Previous
further analysis:
GNOME Bugzilla, Bug 743318, comment 18
https://bugzilla.gnome.org/show_bug.cgi?id=743318#c18
"
PKG_NAME is still used in GNOME 2.28's gnome-autogen.sh in error
messages. (GNOME 3's gnome-autogen.sh queries it from configure.ac
instead of requiring it to be set).
"
Also confirmed that it makes no difference by running ./autogen.sh with
and without PKG_NAME being set. The produced GParted build trees were
the same. Therefore the release and executable can't be affected.
GNOME 3's yelp doesn't use scrollkeeper or the OMF catalog, so the
constructed Makefile doesn't use xmllint to validate the scrollkeeper
DTD file. Therefore remove attempted sed edit of that line which no
longer exists in the Makefile.
Note that help/Makefile.am's @YELP_HELP_RULES@ automake macro expansion
comes from /usr/share/aclocal/yelp.m4 [1].
Commit which previously needed to add the sed edit:
cbb25a2511
Stop xmllint scrollkeeper-omf.dtd fetch failure breaking CI tests (#9)
[1] Yelp > Yelp Tools > yelp.m4
http://yelp.io/tools/yelp.m4.htmlCloses!24 - Port to GNOME 3 yelp-tools documentation infrastructure
Update GParted to specify the GParted Manual using the new GNOME 3 way
with the 'help:' prefix to avoid yelp reporting this error:
Document Not Found
The URI 'ghelp:gparted' does not point to a valid page.
Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
Now with GNOME 3 style help installed, running 'yelp help:gparted'
results in this error being displayed in yelp:
Page Not Found
The requested page was not found in the document 'help:gparted'.
Where as running 'yelp help:gparted/gparted' correctly displays the
GParted Manual.
Fix by renaming the article tag to the default 'index' that yelp is
expecting when using the new GNOME 3 'help:' prefix.
Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
Second part is to use yelp-tools to build and install the documentation.
Have to rename the help Manual from help/C/gparted.xml to
help/C/index.docbook in accordance with this note from the GNOME Goal:
Port to New Documentation Infrastructure [1]:
IMPORTANT: If this is for a DocBook document, the top-level DocBook
file MUST be renamed to index.docbook. Do a "git mv" and include
index.docbook in HELP_FILES.
Commits from gucharmap [4] and totem [5], projects which have DocBook
documentation, making this same change are also useful references.
[1] GNOME Goal: Port To New Documentation Infrastructure
https://wiki.gnome.org/Initiatives/GnomeGoals/NewDocumentationInfrastructure
[2] Yelp > Yelp Tools > yelp.m4
http://yelp.io/tools/yelp.m4.html
[3] GNOME application developement overview / User help / Set up your
build system
https://developer.gnome.org/platform-overview/stable/dev-help-build.html.en
[4] gucharmap commit "Port to new documentation infrastructure"
3e1526c056
[5] totem commit "Use new documentation infrastructure"
59a6bd6064Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
Details of old GNOME 2 gnome-doc-utils:
Migrating your documentation to gnome-doc-utils
https://wiki.gnome.org/Projects/GnomeDocUtils/MigrationHowTo
First part is to stop using gnome-doc-utils to build and install the
documentation. Also since updating the OMF catalog was only needed for
GNOME 2 yelp, use of scrollkeeper is completely removed too.
Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
I generated this by running:
find ./ -type f -exec sed -i 's/ghelp:fdl/help:fdl/g' {} \;
By updating the translations at the same time, it should be easier on
the translators as there's no reason to invalidate these strings.
https://bugzilla.gnome.org/show_bug.cgi?id=704634#c8
[Mike Fleetwood: Explain the underlying cause and distro versions.]
This gnome-desktop commit, first included in version 3.5.5, switched the
package from using gnome-doc-utils to yelp-tools so changed the
installed location of the GNU FDL license file from
/usr/share/gnome/help/fdl/C/fdl.xml to
/usr/share/help/C/fdl/index.docbook, thus changing the yelp URI from
'ghelp:fdl' to 'help:fdl':
8b7e059e2c
Port to new documentation infrastructure
The oldest supported distributions with Gtk/GNOME 3 all have at least
3.10, therefore use this fix unconditionally.
Distribution EOL Gtk/GNOME 3
RHEL / CentOS 7 2024-Jun 3.22
Ubuntu 14.04 LTS 2019-Apr 3.10
Ubuntu 16.04 LTS 2021-Apr 3.18
Debian 8 2023-Apr 3.14
SLES 12 2027-Oct 3.10
Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
The file has been redundant since it was first added [1]. It was never
listed in configure.ac (or configure.in) in AC_CONFIG_FILES. Therefore
autoconf has never produced help/C/Makefile.in and ./configure has never
produced help/C/Makefile. Therefore it isn't used during the build and
install of GParted. Remove it.
[1] 46ca7c74dc
Added code hooks to prepare for GParted Manual
Closes!24 - Port to GNOME 3 yelp-tools documentation infrastructure
These lines in the final configuration report from ./configure were left
behind [1] when determination of the underlying definitions were remove.
So they no longer report 'yes' or 'no' like the other lines in the file
configuration report.
Need partition table re-read workaround? :
Supports large sector sizes (> 512 bytes)? :
Remove them now.
[1] 8df975c7d1
Increase minimum required libparted to 2.2 (!22)
Closes!22 - Increase minimums to libparted 2.2 and glibmm 2.32
According to the GIT history the lines were added by this commit:
8d808c0b62
gparted-0.3.6 - code recreation from Source Forge
Looking at the SVN history this commit actually fleshed out the
implementations of fat16::get_label() and fat32::get_label() and added
the commented #includes:
https://sourceforge.net/p/gparted/svn/118
Added read label support for fat16 and fat32 using mtools mlabel command
2008-02-12
Then this SVN commit moved the mtools temporary file handling code into
Utils.cc, leaving behind the commented #includes:
https://sourceforge.net/p/gparted/svn/124
Added MTools temporary file handling functions
2008-02-19
Finally this commit removed fat32.cc by merging the code with fat16.cc:
519af1a7c0
Combine duplicate code for fat16/32
So remove the left behind commented #includes from fat16.cc.