Commit Graph

155 Commits

Author SHA1 Message Date
Mike Fleetwood 8ce9074ac6 Remove Attempt Data Rescue and use of gpart (!118)
gpart scans a drive trying to guess the location of partitions when an
MBR partition table is lost [1].  However the tool is unmaintained,
takes hours or days of 100% CPU time to scan a drive and provides no
progress indication [2][3][4].  We keep recommending killing the gpart
process and using TestDisk [5] instead.

Therefore remove Device > Attempt Data Rescue and the use of gpart from
GParted.

[1] Gpart
    https://github.com/baruch/gpart
[2] Have you had a good or bad experience with Dev->Attempt Data Rescue?
    http://gparted-forum.surf4.info/viewtopic.php?id=17992
    No good, only bad experiences using gpart were reported.
[3] Gparted does not say anything
    http://gparted-forum.surf4.info/viewtopic.php?id=17749
    Forum user reported waiting 48 hours with no progress indication.
    We recommended using TestDisk.
[4] How cancel Data Rescue process?
    http://gparted-forum.surf4.info/viewtopic.php?id=18143
    Forum user reported it will take 3 days to scan their external 480GB
    drive.  We recommended using TestDisk instead.
[5] TestDisk, Data Recovery
    https://www.cgsecurity.org/wiki/TestDisk

Closes !118 - Remove Attempt Data Rescue and use of gpart
2023-10-04 16:03:09 +00:00
Mike Fleetwood 40665913bf C++11: Convert NULL to nullptr (!117)
In C++11, nullptr [1] is the strongly typed value to use instead of the
macro NULL [2].  Use everywhere [3][4].

[1] nullptr, the pointer literal (since C++11)
    https://en.cppreference.com/w/cpp/language/nullptr
[2] NULL
    https://en.cppreference.com/w/cpp/types/NULL
[3] Bjarne Stroustrup's C++ Style and Technique FAQ, Should I use NULL
    or 0?
    https://www.stroustrup.com/bs_faq2.html#null
        "In C++, the definition of NULL is 0, so there is only an
        aesthetic difference.  I prefer to avoid macros, so I use 0.
        Another problem with NULL is that people sometimes mistakenly
        believe that it is different from 0 and/or not an integer.  In
        pre-standard code, NULL was/is sometimes defined to something
        unsuitable and therefore had/has to be avoided.  That's less
        common these days.

        If you have to name the null pointer, call it nullptr; that's
        what it's called in C++11.  Then, "nullptr" will be a keyword.
        "
[4] What is nullptr in C++? Advantages, Use Cases & Examples
    https://favtutor.com/blogs/nullptr-cpp
        "Advantages of nullptr
        ...
        Compatible: Null pointers are compatible with null pointer
        constants in the C style (such as NULL and 0).  This implies
        that old C code that uses these constants and null pointers can
        communicate with each other in C++.
        "

Closes !117 - Require C++11 compilation
2023-09-23 15:30:15 +00:00
Mike Fleetwood 6bf7668f8e Increase minimum required gtkmm to 3.18.0 (!117)
As discussed in the previous commit the oldest supported distributions
now provide gtkmm versions higher that 3.18.0 (which requires C++11
compilation).  Therefore increase the minimum required version to gtkmm
3.18.0.  This allows removal of HAVE_LABEL_SET_XALIGN autoconf
definition and associated fallback code.

Closes !117 - Require C++11 compilation
2023-09-23 15:30:15 +00:00
Mike Fleetwood 1fbc8988ff Extract repeated code into trim_trailing_new_line() (!105)
Create function to replace repeated code which optionally removes
trailing new line character from a string.

Closes !105 - Update used btrfs file system commands, new minimum is
              btrfs-progs 4.5
2022-08-25 15:41:31 +00:00
Mike Fleetwood 59b3fd068f Always use directory mount point when resizing btrfs (#193)
A user received the following error when attempting to resize a mounted
btrfs file system on their NixOS distribution:

    Shrink /dev/nvme0n1p3 from 933.38 GiB to 894.32 GiB        (ERROR)
    + calibrate /dev/nvme0n1p3  00:00:00                       (SUCCESS)
    + btrfs filesystem resize 1:937759744K '/etc/machine-id'   (ERROR)
        ERROR: not a directory: /etc/machine-id
        ERROR: resize works on mounted filesystems and accepts only
        directories as argument. Passing file containing a btrfs image
        would resize the underlying filesystem instead of the image.

In the partition table section of the gparted_details /dev/nvme0n1p3 was
reported with these mount points:
    /etc/machine-id, /etc/NetworkManager/system-connections,
    /etc/ssh/ssh_host_ed25519_key, /etc/ssh/ssh_host_ed25519_key.pub,
    /etc/ssh/ssh_host_rsa_key, /etc/ssh/ssh_host_rsa_key.pub, /home,
    /nix, /nix/store, /state, /var

The user had a common configuration of NixOS which boots with an empty
tmpfs as root with a few bind mounted files and directories to provide
the needed persistent data [1][2].

Re-create an equivalent situation:
1. Create a btrfs file system and mount it:
    # mkfs.btrfs /dev/sdb1
    # mkdir /mnt/store
    # mount /dev/sdb1 /mnt/store

2. Bind mount a file from this file system else where in the hierarchy.
   The only criteria is that this mount point sorts before /mnt/store.
    # echo 'Test contents' > /mnt/store/test
    # touch /boot/test
    # mount --bind /mnt/store/test /boot/test

  The kernel reports these mount mounts:
    # grep sdb1 /proc/mounts
    /dev/sdb1 /mnt/store btrfs rw,seclabel,relatime,space_cache=v2,subvolid=5,subvol=/ 0 0
    /dev/sdb1 /boot/test btrfs rw,seclabel,relatime,space_cache=v2,subvolid=5,subvol=/ 0 0

3. Use GParted to resize this mounted btrfs file system.  It fails with
   the above error.

GParted read the mount points from /proc/mounts and sorted them.  (See
the end of Mount_Info::load_cache() for the sorting).  When resizing the
btrfs file system GParted just used the first sorted mount point.  This
was the file /etc/machine-id for the user and file /boot/test in the
re-creation, hence the error.

Fix by selecting the first directory mount point to pass to the btrfs
resize command.

[1] NixOS tmpfs as root
    https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/
[2] Erase your darlings
    https://grahamc.com/blog/erase-your-darlings

Closes #193 - path used to resize btrfs needs to be a directory
2022-05-31 17:04:10 +00:00
Mike Fleetwood 1950a7a09d Report busy status of jbds (#89)
Continuing from the state in the previous commit, create an ext4 file
system using the previously created external journal and mount it.
    # mke2fs -t ext4 -J device=/dev/sdb1 -L test-ext4 /dev/sdb2
    # mount /dev/sdb2 /mnt/2

Did some experimenting with trying to create a second file system using
the same external journal which is already in use.
    # mke2fs -t ext4 -J device=/dev/sdb1 -L 2nd-test-ext4 /dev/sdb3
    ...
    /dev/sdb1 is apparently in use by the system; will not make a journal here!
    # exit $?
    1

Examined the source code of mke2fs and found that it performs an
exclusive read-only open of the named journal block device to check if
it is in use by the system or not [1].  Use the same method in GParted.

Not used alternative method would be to mark the jbd active when the
ext3/4 file system using it is active, but that requires working out the
linkage between them.  That can be done using either blkid or dumpe2fs
output but that involves parsing more fields and caching more data so is
much more code than just testing the block device busy status using the
same method which mke2fs uses.

Matching UUIDs via blkid output.
    # blkid /dev/sdb1 /dev/sdb2
    /dev/sdb1: LABEL="test-jbd" UUID="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="jbd"
    /dev/sdb2: LABEL="test-ext4" UUID="cea5c2cd-b21c-4abf-a497-8c073bb12300" EXT_JOURNAL="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="ext4"

Matching UUIDs via dumpe2fs output.
    # dumpe2fs -h /dev/sdb1 | egrep 'Filesystem UUID|Journal users'
    dumpe2fs 1.46.3 (27-Jul-2021)
    Filesystem UUID:          6e52858e-0479-432f-80a1-de42f9a4093e
    Journal users:            cea5c2cd-b21c-4abf-a497-8c073bb12300
    # dumpe2fs -h /dev/sdb2 | egrep 'Filesystem UUID|Journal UUID'
    dumpe2fs 1.46.3 (27-Jul-2021)
    Filesystem UUID:          cea5c2cd-b21c-4abf-a497-8c073bb12300
    Journal UUID:             6e52858e-0479-432f-80a1-de42f9a4093e

If GParted was going to show the journal to file system linkage in the
UI then doing this would be needed.  However so far there has only been
a single reported case of a GParted user using an external journal,
therefore adding the code complexity for this feature is not currently
justified.  The simple busy detection method used by mke2fs is all that
is needed.

[1] mke2fs source code
    https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/
    misc/mke2fs.c:main()
        check_mount(journal_device, force, _("journal"));
    misc/util.c:check_mount()
        ext2fs_check_if_mounted(device, &mount_flags);
    lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
        ext2fs_check_mount_point(file, mount_flags, NULL, 0);
    lib/ext2fs/ismounted.c:ext2fs_check_if_mounted()
        if (stat(device, &st_buf) == 0 &&
            ext2fsP_is_disk_device(st_buf.st_mode)) {
                int fd = open(device, O_RDONLY | O_EXCL);
                if (fd >= 0) {
                        /*
                         * The device is not busy so it's
                         * definitelly not mounted. No need to
                         * to perform any more checks.
                         */
                        close(fd);
                        *mount_flags = 0;
                        return 0;
                } else if (errno == EBUSY) {
                        busy = 1;
                }
        }

Closes #89 - GParted doesn't recognise EXT4 fs journal partition
2022-03-06 16:27:20 +00:00
Mike Fleetwood 157d4e7470 Recognise jbd (journaling block device) (#89)
A user reported that they were using an external journal with an ext4
file system, but that GParted didn't recognise it.  (They had the jbd
on an Intel Optane drive and the ext4 file system on an SSD).

Create a jbd like this:
    # mke2fs -O journal_dev -L test-jbd /dev/sdb1
    # blkid /dev/sdb1
    /dev/sdb1: LABEL="test-jbd" UUID="6e52858e-0479-432f-80a1-de42f9a4093e" TYPE="jbd"

Add recognition of jbd.  Use Blue Shadow colour, the same as ext4,
because jbd is primarily used by ext3/4 [1][2].  jbd is also used by
ocfs2 [1][3] and lustre [4][5] clustered file systems, but they are very
unlikely to encountered by GParted users.  Also xfs [6] and jfs [7] can
have external journals so if recognition of them is ever added they will
get the same colour as their respective file systems too.

[1] Journaling block device
    https://en.wikipedia.org/wiki/Journaling_block_device
    "JBD is filesystem-independent. ext3, ext4 and OCFS2 are known to
    use JBD"
[2] https://ext4.wiki.kernel.org/index.php/Frequently_Asked_Questions#What_are_the_key_differences_between_jbd_and_jbd2.3F
[3] OCFS2: The Oracle Clustered File System, Version 2
    https://www.kernel.org/doc/ols/2006/ols2006v1-pages-289-302.pdf
    "Metadata journaling is done on a per node basis with JBD"
[4] Efficient Object Storage Journaling in a Distributed Parallel File
    System
    https://www.usenix.org/legacy/event/fast10/tech/full_papers/oral.pdf
[5] Lustre Software Release 2.x Operations Manual
    https://doc.lustre.org/lustre_manual.pdf
    6.4.2. Choosing Parameters for an External Journal
[6] mkfs.xfs(8) - construct an XFS filesystem
    https://man7.org/linux/man-pages/man8/mkfs.xfs.8.html
    "OPTIONS
    ...
    logdev=device
        This is used to specify that the log section should reside on
        the device separate from the data section.  The internal=1 and
        logdev options are mutually exclusive.
    "
[7] jfs_mkfs(8) - create a JFS formatted partition
    https://manpages.debian.org/testing/jfsutils/jfs_mkfs.8.en.html
    "OPTIONS
    ...
    -j journal_device
        Create the external JFS journal on journal_device, ...
    "

Closes #89 - GParted doesn't recognise EXT4 fs journal partition
2022-03-06 16:27:20 +00:00
Mike Fleetwood e5041954cf Add detection of bcache (#183)
Use blkid to detect bcache formatted devices.  Requires blkid from
util-linux >= 2.24 for detection of bcache devices [1].

Use util-linux's FS images when testing GParted detection.
    # wget http://git.kernel.org/cgit/utils/util-linux/util-linux.git/plain/tests/ts/blkid/images-fs/bcache-B.img.xz
    # xzcat bcache-B.img.xz > /dev/sdb1
    # wget http://git.kernel.org/cgit/utils/util-linux/util-linux.git/plain/tests/ts/blkid/images-fs/bcache-C.img.xz
    # xzcat bcache-C.img.xz > /dev/sdc1
    # blkid /dev/sdb1 /dev/sdc1
    /dev/sdb1: UUID="8fb7f716-4c19-4517-bfbb-6f4a2becad60" TYPE="bcache" PARTUUID="f8f1485e-01"
    /dev/sdc1: UUID="7a343627-ac87-4bf0-b76f-46067cbc9b8c" TYPE="bcache" PARTUUID="f46e8c86-01"

To tidy-up after testing GParted detection, stop the bcache device in
case it was automatically started and wipe the signatures.  This is to
prevent udev rules from automatically starting the bcache device on
every subsequent reboot.
    # echo 1 > /sys/block/sdb/sdb1/bcache/stop
    # wipefs -a /dev/sdb1 /dev/sdc1

Closes #183 - Basic support for bcache
2022-03-01 16:58:46 +00:00
Mike Fleetwood 6617e6f3a3 Use face skin colours exclusively for software block devices (#183)
Currently the Face Skin colour range from the GNOME palette represent a
mixture of file systems and software block devices:
    JFS          - Face Skin Medium
    LVM2_PV      - Face Skin Dark
    NILFS2       - Face Skin Shadow
    LINUX_SWRAID - Dark Brown
    ATARAID      - Dark Brown

We are about to add recognition of bcache [1][2][3], another software
block device.  Reorganise the colour assignments so that Face Skin
colour range is exclusively used by types of software block devices and
assign JFS and NILFS2 new colours.
    Face Skin Light  (#EFE0CD) -
    Face Skin Medium (#E0C39E) - BCACHE         [New assignment]
    Face Skin Dark   (#B39169) - LVM2_PV
    Face Skin Shadow (#826647) - LINUX_SWRAID   [New assignment]
    Brown Dark       (#5A4733) - ATARAID

NILFS2 has flash friendly characteristics [4] so use Accent Red colours
along with F2FS.
    Accent Red      (#DF421E) - F2FS
    Accent Red Dark (#990000) - NILFS2   [New assignment]

Move JFS to a group with XFS and UFS.  The hue of the GNOME palette
Accent Yellow Dark colour, as used by UFS, was more Orange compared to
Accent Yellow and a bit too close to the Orange used by BTRFS.  So use
the hue of the GNOME Accent Yellow and extend the range and assign like
this.
    Accent Yellow             (#EED680) - XFS
    Accent Yellow Dark        (#D6B129) - JFS   [Updated hue.
                                                 New assignment]
    Accent Yellow Shadow      (#AA8F2C) - UFS   [New colour.
                                                 New assignment]
    Accent Yellow Dark Shadow (#826F2B) -       [New colour]

[1] bcache
    https://bcache.evilpiepirate.org/
[2] Linux kernel document: A block layer cache (bcache)
    https://www.kernel.org/doc/Documentation/bcache.txt
[3] The Linux kernel user's and administrator's guide > A block layer
    cache (bcache)
    https://www.kernel.org/doc/html/latest/admin-guide/bcache.html
[4] NILFS, Relative performance
    https://en.wikipedia.org/wiki/NILFS#Relative_performance

Closes #183 - Basic support for bcache
2022-03-01 16:58:46 +00:00
Mike Fleetwood c4ca7d3e9b Mark remaining get_filesystem_*() methods as returning const strings 2021-04-25 15:49:35 +00:00
Mike Fleetwood 2ccbc3ec92 Extract common code into generate_encryption_mapping_name() (#59)
Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 3c95419ed2 White space tidy-up of Utils::get_filesystem_software()
Put colon directly after case value and list cases in enumeration order.
2021-01-15 19:55:17 +00:00
Mike Fleetwood bd386f445d Add exFAT support (!30)
With exfatprogs (https://github.com/exfatprogs/exfatprogs) installed the
following operations on exFAT file systems are supported:
- Creation
- Checking
- Labelling
As of the current exfatprogs 1.0.4 the following are not supported:
- Reading usage
- Resizing
- Updating the UUID

Closes !30 - Add exFAT support
2021-01-15 19:55:17 +00:00
Mike Fleetwood c85fc66dcf Rename Utils method parameters of type FSType (!52)
Closes !52 - Rename members and variables currently named 'filesystem'
2019-12-04 07:38:00 +00:00
Mike Fleetwood aea6200d5f Recognise ATARAID members (#75)
PATCHSET OVERVIEW

A user had a Firmware / BIOS / ATARAID array of 2 devices configured as
a RAID 0 (stripe) set.  On top of that was a GPT with the OS partitions.
GParted displays the following errors on initial load and subsequent
refresh:

        Libparted Error
    (-) Invalid argument during seek for read on /dev/sda
                          [ Retry ] [ Cancel ] [ Ignore ]

        Libparted Error
    (-) The backup GPT table is corrupt, but the
        primary appears OK, so that will be used.
                              [  Ok  ] [ Cancel ]

This is an Intel Software RAID array which stores metadata at the end of
each member device, and so the first 128 KiB stripe of the set is stored
in the first 128 KiB of the first member device /dev/sda which includes
the GPT for the whole RAID 0 device.  Hence when libparted reads member
device /dev/sda it finds a GPT describing a block device twice it's
size and in results the above errors when trying to read the backup GPT.

A more dangerous scenario occurs when using 2 devices configured in an
Intel Software RAID 1 (mirrored) set with GPT on top.  On refresh
GParted display this error for both members, /dev/sda and /dev/sdb:

        Libparted Warning
    /!\ Not all of the space available to /dev/sda appears to be used,
        you can fix the GPT to use all of the space (an extra 9554
        blocks) or continue with the current setting?
                                                  [  Fix  ] [ Ignore ]

Selecting [Fix] gets libparted to re-write the backup GPT to the end of
the member device, overwriting the ISW metadata!  Do that twice and both
copies of the metadata are gone!

Worked example of this more dangerous mirrored set case.  Initial setup:

    # dmraid -s
    *** Group superset isw_caffbiaegi
    --> Subset
    name   : isw_caffbiaegi_MyMirror
    size   : 16768000
    stride : 128
    type   : mirror
    status : ok
    subsets: 0
    devs   : 2
    spares : 0

    # dmraid -r
    /dev/sda: isw, "isw_caffbiaegi", GROUP, ok, 16777214 sectors, data@ 0
    /dev/sdb: isw, "isw_caffbiaegi", GROUP, ok, 16777214 sectors, data@ 0

    # wipefs /dev/sda
    offset               type
    ---------------------------------------------
    0x200                gpt   [partition table]
    0x1fffffc00          isw_raid_member   [raid]

Run GParted and click [Fix] on /dev/sda.  Now the first member has gone:

    # dmraid -s
    *** Group superset isw_caffbiaegi
    --> *Inconsistent* Subset
    name   : isw_caffbiaegi_MyMirror
    size   : 16768000
    stride : 128
    type   : mirror
    status : inconsistent
    subsets: 0
    devs   : 1
    spares : 0

    # dmraid -r
    /dev/sdb: isw, "isw_caffbiaegi", GROUP, ok, 16777214 sectors, data@ 0

    # wipefs /dev/sda
    offset               type
    ---------------------------------------------
    0x200                gpt   [partition table]

Click [Fix] on /dev/sdb.  Now all members of the array are gone:

    # dmraid -s
    no raid disks

    # dmraid -r
    no raid disks

    # wipefs /dev/sdb
    offset               type
    ---------------------------------------------
    0x200                gpt   [partition table]

So GParted must not run libparted partition table scanning on the member
devices in ATARAID arrays.  Only on the array device itself.

In terms of the UI GParted must show disks which are ATARAID members as
whole disk devices with ATARAID member content and detect array busy
status to avoid allowing active members from being overwritten while in
use.

THIS COMMIT

Recognise ATARAID member devices and display in GParted as whole device
"ataraid" file systems.  Because they are recognised as whole device
content ("ataraid" file systems) this alone stops GParted running the
libparted partition table scanning and avoids the above errors.

The list of dmraid supported formats is matched by the signatures
recognised by blkid:

    $ dmraid -l
    asr     : Adaptec HostRAID ASR (0,1,10)
    ddf1    : SNIA DDF1 (0,1,4,5,linear)
    hpt37x  : Highpoint HPT37X (S,0,1,10,01)
    hpt45x  : Highpoint HPT45X (S,0,1,10)
    isw     : Intel Software RAID (0,1,5,01)
    jmicron : JMicron ATARAID (S,0,1)
    lsi     : LSI Logic MegaRAID (0,1,10)
    nvidia  : NVidia RAID (S,0,1,10,5)
    pdc     : Promise FastTrack (S,0,1,10)
    sil     : Silicon Image(tm) Medley(tm) (0,1,10)
    via     : VIA Software RAID (S,0,1,10)
    dos     : DOS partitions on SW RAIDs

    $ fgrep -h _raid_member util-linux/libblkid/src/superblocks/*.c
            .name           = "adaptec_raid_member",
            .name           = "ddf_raid_member",
            .name           = "hpt45x_raid_member",
            .name           = "hpt37x_raid_member",
            .name           = "isw_raid_member",
            .name           = "jmicron_raid_member",
            .name           = "linux_raid_member",
            .name           = "lsi_mega_raid_member",
            .name           = "nvidia_raid_member",
            .name           = "promise_fasttrack_raid_member",
            .name           = "silicon_medley_raid_member",
            .name           = "via_raid_member",

As they are all types of Firmware / BIOS / ATARAID arrays, report all
members as a single "ataraid" file system type.  (Except for
"linux_raid_member" in the above blkid source listing which is Linux
Software RAID).

Closes #75 - Errors with GPT on RAID 0 ATARAID array
2019-12-02 16:35:22 +00:00
Mike Fleetwood 7be6d0967a Update name of the NILFS2 specific package
Upstream NILFS project calls the package nilfs-utils [1][2].  Arch Linux
/ CentOS / Fedora / OpenSUSE use the upstream name.  However Debian /
Ubuntu name it nilfs-tools [3] instead.

Document the needed software as:

    nilfs-utils / nilfs-tools

Upstream name first separated by slash from alternative names
distributions use.

[1] NILFS Download page
    https://nilfs.sourceforge.io/en/download.html
[2] NILFS Public Git Repositories
    https://nilfs.sourceforge.io/en/git_repos.html
[3] Debian package: nilfs-tools
    https://packages.debian.org/sid/nilfs-tools
2019-11-09 17:18:34 +00:00
Luca Bacci 12f08d38b8 Set the xalign property for Gtk::Labels (!40)
With the same case as from the previous commit, the very long "Mounted
on ..." text is now wrapped, but the text may not be left justified.
Slowly adjust the dialog width and see how the text wrapping is updated
to fit the size adjustment but the text is centred rather than left
justified.

This is because setting the halign property to Gtk::ALIGN_START does not
guarantee left alignment of text for wrapped or ellipsized Gtk::Labels.

Use the xalign property instead.

To set the xalign property there is a method in the GtkMisc (Gtk::Misc)
base class:

  gtk_misc_set_alignment (Gtk::Misc::set_alignment)

However, GtkMisc (Gtk::Misc) was deprecated in Gtk 3.14 (Gtkmm 3.14)
and in Gtk 3.16 (gtkmm 3.16) set_alignment() was replaced with the
introduction of two new methods:

  gtk_label_set_xalign (Gtk::Label::set_xalign)
  gtk_label_set_yalign (Gtk::Label::set_yalign)

Add a check for Gtkmm method Gtk::Label::set_xalign() in configure.ac
and use it when available.

References:

[1] Gtk3 Reference Documentation - gtk_misc_set_alignment()
    https://developer.gnome.org/gtk3/stable/GtkMisc.html#gtk-misc-set-alignment
    "gtk_misc_set_alignment has been deprecated since version 3.14 and
    should not be used in newly-written code. Use GtkWidget's alignment
    ("halign" and "valign") and margin properties or GtkLabel's
    "xalign" and "yalign" properties."

[2] Gtkmm 3.16 Gtk::Misc Class Reference, set_alignment() method
    https://developer.gnome.org/gtkmm/3.16/classGtk_1_1Misc.html#a52b2675874cf46a3097938756b9fe9e8

[3] GNOME BugZilla - EmptyBoxes: instructions_label's alignment is off
    https://bugzilla.gnome.org/show_bug.cgi?id=735841

[4] Gtk commit from 2014-09-16:
    GtkLabel: add x/yalign properties
    https://gitlab.gnome.org/GNOME/gtk/commit/d39424fc

[5] Gtk3 Reference Documentation - gtk_label_set_xalign()
    https://developer.gnome.org/gtk3/stable/GtkLabel.html#gtk-label-set-xalign

[6] Gtkmm 3.16 Gtk::Label Class Reference, set_xalign() method
    https://developer.gnome.org/gtkmm/3.16/classGtk_1_1Label.html#acee7d4e87d7cc14080a7b8ded5f84e5e

Closes !40 - Limit wrapping labels
2019-05-15 16:11:21 +01:00
Luca Bacci 769d19e0f9 Set a default max_width_chars for wrapping Gtk::Labels (!40)
Opening the Partition Information dialog for a file system mounted on a
very long mount point, or on openSUSE which mounts the OS from 10 btrfs
subvolumes from the same partition, will cause the dialog to be very
wide as the "Mounted on ..." text is not wrapped.

Back in Gtk2, when width_chars / max_width_chars were not set, wrapping
labels had a default width beyond which text wrapped onto a new line
[1].

For Gtk3 this default width was first reworked a bit [2], and then was
removed for the very early Gtk3 3.0.10 release [3].

It is recommended that applications explicitly set default values,
otherwise wrapping labels never wrap when requesting their natural
allocation.

References:

[1] Gtk 2.24.32 source code - gtk/gtklabel.c:2975
    https://gitlab.gnome.org/GNOME/gtk/blob/2.24.32/gtk/gtklabel.c#L2975
        "This long string gives a good enough length for any line to
        have."

[2] Gtk commit from 2010-04-21:
    680d7762ba
    Make sure not to base the minimum size on "max-width-chars", only
    the natural size.
        "This string is just about long enough."

[3] Gtk commit from 2011-04-17:
    c8ce1106c1
    label: Don't try to guess a label's size

    People should use window default sizes or label
    width-chars/max-width-chars to find the ideal layout for a label
    instead of relying on magic.

Closes !40 - Limit wrapping labels
2019-05-15 07:36:08 +01:00
Luca Bacci f252e677d4 Ensure icon sizes (#39)
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
2019-04-06 11:42:28 +01:00
Mike Fleetwood e55b3c8544 Replace String::ucompose() with Glibmm equivalent (#46)
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#a64ff7ac3d9e9899c2910f1d831f8d500

Closes #46 - Drop compose subdir
2019-03-27 16:45:22 +00:00
Mike Fleetwood c9f47403b8 Raise the maximum F2FS label size to 127 characters (!29)
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
2019-03-26 08:08:10 +00:00
Mike Fleetwood 45fd146fd0 Go back to symbolic label widget alignment constants
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)
2019-03-23 11:13:30 -06:00
Luca Bacci 4b87839502 port-to-gtk3: Rework Glibmm header includes (#7)
Now that we are compiling against Gtkmm3 there are missing declarations
of Glibmm identifiers due to changes in Gtkmm internal header structure.

All we have to do is bring back the declarations by including the
appropriate headers where needed.

Add necessary Glibmm header includes.

Closes #7 - Port to Gtk3
2019-02-11 08:57:18 +00:00
Mike Fleetwood a0f97bfa19 Improve translation help for "unformatted" file system type 2018-11-12 13:53:04 -07:00
Mike Fleetwood 8a4f9ad205 Adjust shades of aquamarine, cyan and orange
The shades of aquamarine, cyan and orange didn't fit with the GNOME
32-colour palette.  Create a set of aquamarine, cyan and orange shades
which match the GNOME palette shades and update the colours of the
relevant file systems accordingly.
    Aquamarine Hilight (#97DFC7) -
    Aquamarine Medium  (#70D2B1) - NTFS
    Aquamarine Dark    (#3EA281) - REFS
    Aquamarine Shadow  (#1F7258) -
    Cyan Hilight       (#95E3E5) - EXTENDED
    Cyan Medium        (#6FCECE) -
    Cyan Dark          (#3C9899) -
    Cyan Shadow        (#166F70) -
    Orange Hilight     (#E59F6A) -
    Orange Medium      (#E58749) - BTRFS
    Orange Dark        (#C26825) - ZFS
    Orange Shadow      (#984F18) -

Note that the hues of aquamarine and cyan are quite close and for the
thin outlines of partitions used in GParted they aren't easy to
distinguish.  Hence also using different lightness to additionally
separate the colour for extended partitions from NTFS and ReFS file
systems.
2018-11-12 20:39:55 +00:00
Mike Fleetwood 69c1537a38 Recognise APFS (Apple File System) (#23)
Just add detection of APFS using GParted's internal magic string
detection.  It just matches 1 byte of the 2 byte object type and the
4 byte magic field found in the super block [1].  See code comment for
more details.

Blkid has just gained recognition of APFS with util-linux v2.33 released
06-Nov-2018 [2].

This will write enough for GParted's simple internal detection to find
APFS:
    # python -c '
    import sys
    sys.stdout.write("\0"*24 + "\1\0" + "\0"*6 + "NXSB")
    ' > /dev/sdb1

[1] Apple File System Reference
    https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf

[2] [ANNOUNCE] util-linux v2.33
    https://marc.info/?l=linux-fsdevel&m=154150400305928&w=2

Closes #23 - GParted doesn't detect APFS (Apple File System)
2018-11-12 20:39:55 +00:00
Mike Fleetwood 893b67e2b8 Switch HFS and HFS Plus colours to a magenta range (#23)
Currently Linux Swap, Linux Suspend, and HFS use reds from the GNOME
32-colour palette with HFS Plus using serene red outside that palette.
    HFSPLUS       - Serene Red
    HFS           - Red Hilight
    LINUX_SWAP    - Red Medium
    LINUX_SUSPEND - Red Dark
                  - Red Shadow

Apple have a new file system, APFS (Apple File System), which is a
successor to HFS Plus [1][2].  With HFS Plus using a colour outside the
GNOME 32-colour palette and there not being enough distinct reds
available for a new file system, create a new range of magenta colours
which fit with the GNOME palette and use them for the group of Apple
file systems.
    Magenta Hilight (#D59FD4) - HFS
    Magenta Medium  (#B173B0) - HFSPLUS
    Magenta Dark    (#874986) - APFS
    Magenta Shadow  (#662C64) -

This commit just moves HFS and HFS Plus to their new magenta colours.

[1] About Apple File System
    https://developer.apple.com/documentation/foundation/file_system/about_apple_file_system

    "Overview
    Apple File System replaces HFS Plus as the default file system for
    iOS 10.3 and later, and for macOS High Sierra and later.  Apple File
    System offers improved file system fundamentals as well as several
    new features, including cloning, snapshots, space sharing, fast
    directory sizing, atomic safe-save, and sparse files.
    "

[2] Apple File System Reference
    https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf

    "About Apple File System
    Apple File System is the default file format used on Apple
    platforms.  Apple File System is the successor to HFS Plus, so some
    aspects of its design intentionally follow HFS Plus to enable data
    migration from HFS Plus to Apple File System.  Other aspects of its
    design address limitations with HFS Plus and enable features such as
    cloning files, snapshots, encryption, and sharing free space between
    volumes.
    "

Closes #23 - GParted doesn't detect APFS (Apple File system)
2018-11-12 20:39:55 +00:00
Mike Fleetwood df0d4c870b White space tidy-up of Utils::get_filesystem_string()
Use smart tab alignment, list cases in enumeration order and update
translation help for unallocated space.
2018-09-17 15:36:09 +00:00
Mike Fleetwood d3ef32096a Re-assign UFS to be a basic supported file system (!13)
There is no prospect of there being ufs-tools on Linux.  The was a
project which did release ufs-tools version 0.1 in 2004, but has been
inactive since then.
    http://ufs-linux.sourceforge.net/

Copying and moving is now implemented for file systems in the basic
supported category.  Also mounting and unmounting of unsupported file
system and reporting their usage while mounted has been added.  This is
all the support that GParted has ever implemented for UFS.  Therefore
re-assign UFS as a basic supported file system as it looses no
functionality.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood 9a66139eff Add "other" file system type (!13)
Want a single term under which the supported actions for all basic
supported file systems are displayed in the File System Support dialog.
"Unknown" isn't the correct adjective because the group includes
unknown, but also includes: BitLocker, GRUB2 core image, ISO9660, Linux
SWRaid, Linux Suspend, REFS and ZFS.  Add "other" file system type just
for displaying in the dialog.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood f61481f3ae Separate unknown file system type from unsupported actions (!13)
PATCHSET OVERVIEW:

Forum user wanted to be able to move a partition with unknown content:
    Topic: Can't move/rezise partition on android device (unknown format)
    http://gparted-forum.surf4.info/viewtopic.php?id=17742

While GParted isn't going to be able to run any sort of file system
check on the unknown content there isn't any reason why such a partition
can't be copied or moved so long as the partition stays the same size.
GParted can just use it's existing internal block copy routine it uses
for copying and moving most partition content.  This is no different to
a few of the already supported file system types which don't have a
check-repair tool: exfat, f2fs, nilfs2, udf, ufs.

This patchset introduces a third category called basic file system
support to go along with the existing full and unsupported categories.
Basic supported file systems will just use GParted's inbuilt
capabilities to perform actions so they won't need a derived FileSystem
implementation class.  Unknown file systems along with all other
recognised, but otherwise unsupported, file systems will be assigned to
this new basic supported category.

THIS PATCH:

FS_UNKNOWN is used when GParted is unable to identify the contents of a
partition.  FS_UNKNOWN is also used to generate a file system support
set with no supported actions, in the FileSystem::FS::FS() constructor
and in GParted_Core::get_fs().

As support for operations on partitions with unknown content is being
added, the second usage will be confusing or even wrong.
FS( FS_UNKNOWN ) constructs the no supported actions set, yet GParted
will support some actions for the FS_UNKNOWN file system type.
Therefore add FS_UNSUPPORTED for the second usage.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood 4542f34fed White space tidy-up of Utils::get_color()
No functional change.  The code layout is old and a mess, not lining up
vertically.  Use more common code layout and spaces to align text
vertically.  List cases in enumeration order.  Identify each colour
choice as either in the GNOME palette (no marking), an extended shade to
a colour in the GNOME palette [+], or a colour outside the GNOME palette
[*].

There's lots of other switch statements just in Utils.cc which could do
with tidying up, but this is the one I am looking at now.
2018-08-25 08:39:30 +01:00
Mike Fleetwood 1c651de338 Switch FAT16/32 colours to Accent Greens from the GNOME palette
FAT16 was a fully saturated green (RGB #00FF00) and FAT32 was a little
darker.  These are out of character with the colours from the GNOME
palette for other file systems.  Change the colours to use near
alternative Accent Greens from the GNOME colour palette.  So now we have
the following file system colours, from light to dark:
    FAT16 - Accent Green Hilight
    FAT32 - Accent Green
    EXFAT - Accent Green Dark
    UDF   - Accent Green Shadow

Strictly speaking only Accent Green and Accent Green Dark are part of
the GNOME palette.  Accent Green Hilight and Accent Green Shadow are
extensions expanding the range of Accent Greens.

    GNOME Human Interface Design 2.2.1 / Visual Design / colour /
    https://developer.gnome.org/hig-book/2.32/design-color.html.en

    "Guidelines
    * Use the GNOME color palette.  If you need a darker or lighter
      shade, start from one of the colors from the palette and darken or
      lighten as needed.
    "
2018-08-24 20:22:21 +01:00
Mike Fleetwood 03e89b1289 Add support for minix file system (!12)
Util-linux package, at least as far back as version 2.23.2 as found on
CentOS 7, provides the mkfs.minix and fsck.minix commands.  Also blkid
from the same package, recognises minix file systems.

Create version 3 file systems because MINIX 3 [1] is the only supported
version and that reportedly uses version 3 of the file system [2].

[1] MINIX 3 / History
    https://en.wikipedia.org/wiki/MINIX_3#History

[2] Regarding MINIX 3 file system
    https://groups.google.com/forum/#!topic/minix3/3-TeHR_23X8

    "MINIX 3 uses Minix File System (MFS).  More precisely MFS V3."

Closes !12 - Add minix file system support
2018-08-24 20:22:08 +01:00
Mike Fleetwood 92f6946e24 Use one shade darker blue for EXT2/3/4 file systems (!12)
I see the MINIX file system as a kind of forerunner to EXT* because of
it's history [1].  No body uses the original EXT file system any more,
however the MINIX file system is still used by the MINIX 3 operating
system.  So use the same range of colours for MINIX and EXT2/3/4.  Use
one shade darker blue for EXT2/3/4, allowing MINIX to use the lightest
blue.  After adding MINIX support in the next patch, the colours will
become:
    MINIX - Blue Hilight
    EXT2  - Blue Medium
    EXT3  - Blue Dark
    EXT4  - Blue Shadow

[1] MINIX file system / History
    https://en.wikipedia.org/wiki/MINIX_file_system#History

    "When Linus Torvalds first started writing his Linux operating
    system kernel (1991), he was working on a machine running MINIX, and
    adopted its file system layout.  This soon proved problematic, since
    MINIX restricted filename lengths to fourteen characters (thirty in
    later versions), it limited partitions to 64 megabytes, and the file
    system was designed for teaching purposes, not performance.  The
    Extended file system (ext; April 1992) was developed to replace
    MINIX's, but it was only with the second version of this, ext2, that
    Linux obtained a commercial-grade file system.  As of 1994, the
    MINIX file system was "scarcely in use" among Linux users.
    "

Closes !12 - Add minix file system support
2018-08-24 20:21:58 +01:00
Mike Fleetwood 8dff80edc6 Add ability for small writes to stdin of child processes (#795617)
As discussed in "LUKS password handling, threats and preventative
measures" [1] GParted must be able to pass LUKS passphrases to
cryptsetup via standard input to avoid having to write passwords to the
file system and deal with additional security requirements.  Therefore
add a way to write input into created child processes.  For small
amounts of input, writing up to the pipe buffer capacity won't block
[2].  This is 64K on versions of Linux in any currently supported
distributions.

[1] LUKS password handling, threats and preventative measures
    https://bugzilla.gnome.org/show_bug.cgi?id=627701#c56

    GParted must not become a password manage so it must never save
    LUKS passwords to disk across separate invocations of GParted.
    ...

    GParted should avoid writing a temporary file containing the LUKS
    password as it introduces extra complexity with trying to safely
    handle and erase file content.  Instead GParted must
    programmatically pass the LUKS password via standard input to the
    cryptsetup command.

[2] pipe(7) manual page:

    Pipe capacity
        A pipe has a limited capacity.  If the pipe is full, then a
        write(2) will block or fail, depending on whether the O_NONBLOCK
        flag is set (see below).  ...

        In Linux versions before 2.6.11, the capacity of a pipe was the
        same as the system page size (e.g., 4096 bytes on i386).  Since
        Linux 2.6.11, the pipe capacity is 65536 bytes.

Bug 795617 - Implement opening and closing of LUKS mappings
2018-04-30 09:10:48 -06:00
Mike Fleetwood 07f58ed82b Raise minimum required glibmm version to 2.14.0 (#794253)
Increase the minimum required version of glibmm to 2.14.0, thus allowing
removal of the HAVE_GLIB_REGEX autoconf definition and associated
conditional code.  This is reversing commit, except for the new glibmm
minimum check:

    456932846b
    Implement fallback if Glib::Regex class is missing (#695279)

Bug 794253 - Desupport RHEL / CentOS 5 and raise minimum required
             versions to glibmm 2.14.0 and gtkmm 2.16.0
2018-03-26 10:16:45 -06:00
Mike Fleetwood 175d27c55d Rename enum FILESYSTEM to FSType
There are too many different types of things named "filesystem" in the
GParted code with the potential to cause confusion.  Namely:

    std::vector<FS> FILESYSTEMS
                              Vector of file system capabilities.

    class FileSystem          Base class interfacing to file system
                              specific executables for querying and
                              modification.

    enum FILESYSTEM           Symbolic constants representing each file
                              system type.

Many recent written or re-written functions already used a variable
named fstype.  Rename enum FILESYSTEM to enum FSType to clearly
distinguish it from the other things with very similar names.  Only
changing the name of the enumeration, not the name of variables of that
type too because that is a lot more lines of code and those can be
changed when the relevant code is re-written.
2018-01-28 10:09:35 -07:00
Mike Fleetwood 32c483c314 Fix cannot format error dialog which always reported the file system as encrypted
Try to format an existing partition with a file system which doesn't
fit.  The error dialog reporting the partition as too small or too large
always claimed the file system was encrypted, whether it was or not.
For example trying to format a 128 MiB partition as btrfs produces this
error dialog:

    (-) Cannot format this file system to [Encrypted] btrfs
        A [Encrypted] btrfs file system requires
        a partition of at least 256.00 MiB.
                                                   [  OK  ]

This commit:
    88136c96d7
    Extend functions generating encrypted file system string (#774818)
just completely missed handling the case for non-encrypted file systems
in Utils::get_filesystem_string().  Add the missed code.
2018-01-28 10:09:35 -07:00
Pali Rohár 8fdc2c21a6 Correctly quote and escape arguments passed to external commands (#787203)
Trying to set a file system label to (including the double quotes):
    " --help "
fails.  For example labelling an ext4 file system would try to run this
command:
    # e2label /dev/sdb1 "" --help ""
    Usage: e2label device [newlabel]
    # echo $?
    1

Alternatively trying to create a file system with a label of just a
double quote also fails.  The Applying Pending Operations dialog waits
forever and won't cancel or force cancel.  Have to use the window
manager close window button to close the dialog.  Also GParted reports
this error to the console:
    (gpartedbin:9648): glibmm-CRITICAL **:
    unhandled exception (type Glib::Error) in signal handler:
    domain: g-shell-error-quark
    code  : 0
    what  : Text ended before matching quote was found for ". (The text was 'mkfs.xfs -f -L """ /dev/sdb2')

Command strings are parsed and split into argv array by function
Glib::shell_parse_argv() which calls internal glib function
tokenize_command_line() for shell tokenization.  It expects the command
string to be properly quoted and escaped and after tokenization, calls
g_shell_unquote() on every parsed argument.  So to prevent constructing
incorrect commands, every non-static string needs to be properly quoted.

GParted only puts labels and mount points into double quotes, but has
not escaped special characters in those values itself.  This patch
fixes all these problems by using Glib::shell_quote() on all variable
values.  Labels, mount points, paths and all others too.

Probably a better solution would be to use a new function which takes
argv array instead of one string with all the, correctly quoted and
escaped, arguments concatenated together.

Bug 787203 - Correctly quote and escape arguments of external programs
             passed to execute_command()
2017-09-21 20:00:26 +01:00
Pali Rohár 861bc8df5d Add support for long UDF labels and check for old versions of mkudffs (#784533)
UDF label is stored in the Logical Volume Identifier which has space for
either 126 Latin1 or 63 UCS-2 characters.  For compatibility reasons
with older versions of blkid, the possibly truncated UDF label is also
stored in the Volume Identifier which only has space for 30 Latin1 or 15
UCS-2 characters.

Because versions of mkudffs prior to 1.1 damage the label if it contains
non-ASCII characters, make sure GParted does not call such versions of
mkudffs with a non-ASCII character label.

Bug 784533 - Add support for UDF file system
2017-07-30 09:50:09 +01:00
Mike Fleetwood 7feb84a219 Minor update of colour for exFAT
Colour for exFAT was a Sea Green.  This is close to Accent Green Dark
from the GNOME colour palette.  Use that instead.
2017-07-10 19:17:05 +01:00
Pali Rohár 5f327feb25 Add support for UDF file system (#784533)
Add support for detecting UDF file systems and formatting hard disks
with revision 2.01 UDF file systems using udftools.  Formatting optical
disks or any other media types is not supported yet.  Changing label or
UUID after formatting is not supported as the tools do not yet exist.

Bug 784533 - Add support for UDF file system
2017-07-10 19:17:05 +01:00
Mike Fleetwood a233e30efe Move initial clearing of output capture buffers into PipeCapture class (#777973)
Seems more logical to initially clear the output capture buffer in a
single location in the PipeCapture class which reads the command output
into said buffer, rather than each calling site before the PipeCapture
objects are constructed.

Bug 777973 - Segmentation fault on bad disk
2017-06-02 11:47:35 -06:00
Mike Fleetwood 34185afbf1 Document new requirement on the cryptsetup command (#774818)
Bug 774818 - Implement LUKS read-write actions NOT requiring a
             passphrase
2017-01-14 08:49:58 -07:00
Mike Fleetwood 88136c96d7 Extend functions generating encrypted file system string (#774818)
Already have:
    Utils::get_filesystem_string(FS_EXT2)          -> "ext2"
    virtual Partition::get_filesystem_string()     -> "ext2"
    virtual PartitionLUKS::get_filesystem_string() -> "[Encrypted] ext2"
Add these:
    Utils::get_encrypted_string()                  -> "[Encrypted]"
    Utils::get_filesystem_string(false, FS_EXT2)   -> "ext2"
    Utils::get_filesystem_string(true, FS_EXT2)    -> "[Encrypted] ext2"

This is ready for use of Utils::get_filesystem_string(true, FS_EXT2)
when composing the preview of a format of an encrypted file system by
Win_GParted::activate_format().

Bug 774818 - Implement LUKS read-write actions NOT requiring a
             passphrase
2017-01-14 08:49:58 -07:00
Curtis Gedak f762c0cc34 Add detection of iso9660 file system (#771244)
Requires blkid.

Note that FS_LUKS was also moved to more closely match the order in
include/Utils.h

Bug 771244 - gparted does not recognize the iso9660 file system in
             cloned Ubuntu USB boot drives
2017-01-06 10:47:11 -07:00
Mike Fleetwood 8979913a3f Remove "../include/" from GParted header #includes
It made the code look a little messy, is easily resolved in the build
system and made the dependencies more complicated than needed.  Each
GParted header was tracked via multiple different names (different
numbers of "../include/" prefixes).  For example just looking at how
DialogFeatures.o depends on Utils.h:

    $ cd src
    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/../include/Utils.h \
     ../include/../include/../include/../include/../include/../include/Utils.h \
     ../include/../include/../include/Utils.h \

After removing "../include/" from the GParted header #includes, just
need to add "-I../include" to the compile command via the AM_CPPFLAGS in
src/Makefile.am.  Now the dependencies on GParted header files are
tracked under a single name (with a single "../include/" prefix).  Now
DialogFeatures.o only depends on a single name to Utils.h:

    $ make DialogFeatures.o
    $ egrep ' [^ ]*Utils.h' .deps/DialogFeatures.Po
     ../include/DialogFeatures.h ../include/Utils.h ../include/i18n.h \
2016-12-12 13:15:34 -07:00
Mike Fleetwood 8ac3a0e4ad Recognise GRUB2 core.img (#766989)
Recognise GRUB2 core.img boot code written to a partition without a file
system.  Such setups are possible/likely with GPT partitioned disks as
there is a specific partition type reserved for it [1][2]:
    21686148-6449-6E6F-744E-656564454649  (BIOS Boot partition)

[1] GUID Partition Table, Partition types
    https://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs

[2] BIOS boot partition
    https://en.wikipedia.org/wiki/BIOS_boot_partition

Bug 766989 - zfsonline support - need file system name support for ZFS
             type codes
2016-06-15 12:45:05 -06:00
Mike Fleetwood b0bd465098 Fix formatting of negative time values (#760709)
... to display a negative sign before the hours, minutes and seconds.
Before:
    Utils::format_time(-1)   = "00:00:0-1"
    Utils::format_time(-119) = "00:0-1:0-59"
After:
    Utils::format_time(-1)   = "-00:00:01"
    Utils::format_time(-119) = "-00:01:59"

Bug 760709 - Add progress bars to XFS and EXT2/3/4 file system specific
             copy methods
2016-02-12 09:09:57 -07:00