Commit graph

3128 commits

Author SHA1 Message Date
Мирослав Николић f3df5d14a1 Updated Serbian translation 2016-08-20 22:47:35 +02:00
Aurimas Černius 4632ef4286 Updated Lithuanian translation 2016-08-15 13:20:32 +03:00
Mike Fleetwood e6f4b1c305 Remove no longer needed includes from GParted_Core.cc
No longer needed since commit:
    504eb04ddc
    Roll back (remove) code to recognize /dev/mapper/* devices, because ...
2016-08-06 09:47:58 -06:00
Mike Fleetwood 63ec73dfda Split mount_info and fstab_info maps into separate Mount_Info module
The GParted_Core::mount_info and GParted_Core::fstab_info maps and the
methods that manipulate them are self-contained.  Therefore move them to
a separate Mount_Info module and reduce the size of the monster
GParted_Core slightly.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 0785c5d7ef Remove unimplemented prototype DMRaid::partition_is_mounted_by_path() 2016-08-06 09:47:58 -06:00
Mike Fleetwood a94be2da05 Switch to static class interface for FS_Info
The FS_Info module has a pseudo multi-object interface and used the
constructor to load the cache.  However all the data in the class is
static.  An FS_Info object doesn't contain any member variables, yet was
needed just to call the member functions.

Make all the member functions static removing the need to use any
FS_Info objects and provide an explicit load_cache() method.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 5055c0b638 Simplify whole device matching in load_proc_partitions_Info_cache()
Following earlier commit "Pre-populate BlockSpecial cache while reading
/proc/partitions (#767842)" load_proc_partitions_info_cache() has
extracted just the name field from each line of /proc/partitions.
Therefore simplify the regular expressions matching each type of whole
disk device to just matching in the name field rather than matching in
the whole line.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 912766c2e1 Switch to a static interface for Proc_Partitions_Info
The Proc_Partitions_Info has a pseudo multi-object interface and uses
the constructor to load the cache.  However all the data in the class is
static.  A Proc_Partitions_Info object doesn't contain any member
variables, yet was needed just to call the member functions.

Make all the member functions static removing the need to use any
Proc_Partitions_Info objects and provide and explicit load_cache()
method.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 91e5a0960e Remove remaining use of retired vol_id
Vol_id has been retired and removed from all supported distributions.
See earlier commit "Remove use of retired vol_id from FS_Info module
(#767842)" for more details.  Therefore remove it's use from GParted
entirely.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 571304d2c6 Pre-populate BlockSpecial cache while reading /proc/partitions (#767842)
GParted is already reading /proc/partitions to get whole disk device
names.  The file also contains the major, minor device number of every
partition.  Use this information to pre-populate the cache in the
BlockSpecial class.

    # cat /proc/partitions
    major minor  #blocks  name

       8        0   20971520 sda
       8        1     512000 sda1
       8        2   20458496 sda2
    ...
       9        3    1047552 md3
     259        2     262144 md3p1
     259        3     262144 md3p2
    ...
     253        0   18317312 dm-0
     253        1    2097152 dm-1
     253        2    8383872 dm-2
     253        3    1048576 dm-3

Note that for Device-Mapper names (dm-*) the kernel is not using the
canonical user space names (mapper/*).  There is no harm in
pre-populating the cache with these names and will help if tools report
them too.  It is just that for DMRaid, LVM and LUKS, GParted uses the
canonical /dev/mapper/* names so will still have to call stat() once for
each such name.

For plain disks (sd*) and Linux Software RAID arrays (md*) the kernel
name is the common user space name too, therefore matches what GParted
uses and pre-populating does avoid calling stat() at all for these
names.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 003d6eff94 Cache looked up major, minor numbers in BlockSpecial class (#767842)
Creation of every BlockSpecial object used to result in a stat() OS
call.  On one of my test VMs debugging with 4 disks and a few partitions
on each, GParted refresh generated 541 calls to stat() in the
BlockSpecial(name) constructor.  However there were only 45 unique
names.  So on average each name was stat()ed approximately 12 times.

Cache the major, minor number associated with each name after starting
with a cleared cache for each GParted refresh.  This reduces these
direct calls to stat() to just the 45 unique names.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood ce8fb1dd91 Use BlockSpecial in FS_Info module cache (#767842)
The FS_Info cache is loaded from "blkid" output and compares block
special names.  Therefore switch to using BlockSpecial objects so that
comparisons are performed by the major, minor device number instead.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 23da3ab9a8 Parse FS_Info cache into fields while loading (#767842)
FS_Info module caches the output from blkid as a single string and uses
regular expressions to find the line matching the requested block
special file name.  This is not compatible with using BlockSpecial
objects to represent block special files, and perform matching by major,
minor device number.  Therefore parse the blkid output into a vector of
structures containing the needed fields, ready for switching to
BlockSpecial objects in the following patch.

Interface to the module remains unchanged.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 8aa34f7baa Remove use of retired vol_id from FS_Info module (#767842)
Vol_id was removed from udev 142, released 2009-05-13, and udev switched
to using blkid instead [1].  All currently supported distributions use
later versions of udev (or systemd after the udev merge), except for
RedHat / CentOS 5 with udev 095.  However RedHat / CentOS 5 does provide
blkid and vol_id is found in udev specific /lib/udev directory not on
the PATH.  Therefore effectively vol_id is not available on any
supported distribution and blkid is always available.  Therefore remove
use of vol_id from the FS_Info module.  Less code to refactor and test
in following changes.

[1] delete vol_id and require util-linux-ng's blkid
    http://git.kernel.org/cgit/linux/hotplug/udev.git/commit/?id=f07996885dab45102492d7f16e7e2997e264c725

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 2b013e494c Use BlockSpecial in SWRaid_Info module cache (#767842)
The SWRaid_Info cache is loaded from "mdadm" command output and
/proc/mdstat file.  It contains the member name which is used to access
the cache, therefore switch to using BlockSpecial objects so that
comparison is performed using the major, minor device number.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 7cd574cac5 Use BlockSpecial in LUKS_Info module cache (#767842)
The LUKS_Info module cache is loaded from "dmsetup" command and compares
block special files, therefore switch to using BlockSpecial objects so
that comparisons are performed by major, minor device number.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood e4a8530b14 Overload is_dev_mounted() function (#767842)
Small optimisation which avoids constructing an extra BlockSpecial
object when determining if a btrfs member is mounted.  Rather than
extracting the name from the BlockSpecial object in
btrfs::get_mount_device() and re-constructing another BlockSpecial
object from that name in GParted_Core::is_dev_mounted(), pass the
BlockSpecial object directly.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood abee66484f Use BlockSpecial objects in btrfs member cache (#767842)
There are no known errors which affect the remaining caches in GParted.
However those caches which compare block special devices will be changed
to use BlockSpecial objects so comparison is by major, minor device
number rather than by name.

Change btrfs member cache loaded from "btrfs filesystem show" output to
use BlockSpecial objects.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood a800ca8b68 Add BlockSpecial into mount_info and fstab_info (#767842)
On some distributions having btrfs on top of LUKS encrypted partitions,
adding a second device and removing the first device used to mount the
file system causes GParted to no longer be able to report the file
system as busy or the mount points themselves.

For example, on CentOS 7, create a single btrfs file system and mount
it.  The provided /dev/mapper/sdb1_crypt name is reported, via
/proc/mounts, as the mounting device:
    # cryptsetup luksFormat --force-password /dev/sdb1
    # cryptsetup luksOpen /dev/sdb1 sdb1_crypt
    # mkfs.btrfs -L encrypted-btrfs /dev/mapper/sdb1_crypt
    # mount /dev/mapper/sdb1_crypt /mnt/1

    # ls -l /dev/mapper
    total 0
    lrwxrwxrwx. 1 root root       7 Jul  2 14:15 centos-root -> ../dm-1
    lrwxrwxrwx. 1 root root       7 Jul  2 14:15 centos-swap -> ../dm-0
    crw-------. 1 root root 10, 236 Jul  2 14:15 control
    lrwxrwxrwx. 1 root root       7 Jul  2 15:14 sdb1_crypt -> ../dm-2
    # fgrep btrfs /proc/mounts
    /dev/mapper/sdb1_crypt /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0

Add a second device to the btrfs file system:
    # cryptsetup luksFormat --force-password /dev/sdb2
    # cryptsetup luksOpen /dev/sdb2 sdb2_crypt
    # btrfs device add /dev/mapper/sdb2_crypt /mnt/1

    # ls -l /dev/mapper
    ...
    lrwxrwxrwx. 1 root root       7 Jul  2 15:12 sdb2_crypt -> ../dm-3
    # btrfs filesystem show /dev/mapper/sdb1_crypt
    Label: 'encrypted-btrfs'  uuid: 45d7b1ef-820c-4ef8-8abd-c70d928afb49
            Total devices 2 FS bytes used 32.00KiB
            devid    1 size 1022.00MiB used 12.00MiB path /dev/mapper/sdb1_crypt
            devid    2 size 1022.00MiB used 0.00B path /dev/mapper/sdb2_crypt

Remove the first mounting device from the btrfs file system.  Now the
non-canonical name /dev/dm-3 is reported, via /proc/mounts, as the
mounting device:
    # btrfs device delete /dev/mapper/sdb1_crypt /mnt/1

    # btrfs filesystem show /dev/mapper/sdb2_crypt
    Label: 'encrypted-btrfs'  uuid: 45d7b1ef-820c-4ef8-8abd-c70d928afb49
            Total devices 1 FS bytes used 96.00KiB
            devid    2 size 1022.00MiB used 144.00MiB path /dev/mapper/sdb2_crypt
    # fgrep btrfs /proc/mounts
    /dev/dm-3 /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0
    # ls -l /dev/dm-3
    brw-rw----. 1 root disk 253, 3 Jul  2 15:12 /dev/dm-3

GParted loads the mount_info mapping from /proc/mounts and with it the
/dev/dm-3 name.  When GParted is determining if the encrypted btrfs file
system is mounted or getting the mount points it is using the
/dev/mapper/sdb2_crypt name.  Therefore no information is found and the
file system is incorrectly reported as unmounted.

Fix by changing mount_info and fstab_info to use BlockSpecial objects
instead of strings so that matching is performed by major, minor device
numbers rather than by string compare.  Note that as BlockSpecial
objects are used as the key of std::map [1] mappings operator<() [2]
needs to be provided to order the key values.

[1] std::map
    http://www.cplusplus.com/reference/map/map/
[2] std::map::key_comp
    http://www.cplusplus.com/reference/map/map/key_comp/

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood ab2d4f5ee6 Create BlockSpecial class and use in LVM2_PV_Info (#767842)
In some cases creating an LVM2 Physical Volume on top of a DMRaid array
reports no usage information and this partition warning:
    Unable to read the contents of this file system!
    Because of this some operations may be unavailable.
    The cause might be a missing software package.
    The following list of software packages is required for lvm2
    pv file system support: lvm2.

For example on Ubuntu 14.04 LTS (with GParted built with
--enable-libparted-dmraid) create an LVM2 PV in a DMRaid array
partition.  GParted uses this command:
    # lvm pvcreate -M 2 /dev/mapper/isw_bacdehijbd_MyArray0p2

But LVM reports the PV having a different name:
    # lvm pvs
      PV                                                VG   Fmt  Attr PSize PFree
      /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2      lvm2 a--  1.00g 1.00g

This alternate name is loaded into the LVM2_PV_Info module cache.  Hence
when GParted queries partition /dev/mapper/isw_bacdehijbd_MyArray0p2 it
has no PV information against that name and reports unknown usage.

However they are actually the same block special device; major 252,
minor 2:
    # ls -l /dev/mapper/isw_bacdehijbd_MyArray0p2
    brw-rw---- 1 root disk 252, 2 Jul  2 11:09 /dev/mapper/isw_bacdehijbd_MyArray0p2

    # ls -l /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2
    lrwxrwxrwx 1 root root 10 Jul  2 11:09 /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2 -> ../../dm-2
    # ls -l /dev/dm-2
    brw-rw---- 1 root disk 252, 2 Jul  2 11:09 /dev/dm-2

To determine if two names refer to the same block special device their
major, minor numbers need to be compared, instead of string comparing
their names.

Implement class BlockSpecial which encapsulates the name and major,
minor numbers for a block special device.  Also performs comparison as
needed.  See bug 767842 comments 4 and 5 for further investigation and
decision for choosing to implement a class.

Replace name strings in the LVM2_PV_Info module with BlockSpecial
objects performing correct block special device comparison.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 0f4df8dfd1 Remove now unused Proc_Partitions_Info::get_alternate_paths() (#767842)
Now Device and Partition objects only have a single path,
get_alternate_paths() is never called.  Remove the method and population
of the private alternate_paths_cache member that went with it.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 40f39bdbe2 Rename Partition::add_path() to set_path() (#767842)
To reflect that there is now only a single path in the Partition object
now.  Also get rid of the now unneeded optional clear_paths parameter
which was only relevant when there was a vector of paths.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 54652b0d4e Update calibrate_partition() for single partition path (#767842)
Now that Partition objects only have a single path, rather than a list
of paths, stop performing unnecessary actions in calibrate_partitions()
which added alternate paths reported from libparted.  Just left with
setting the partition path name correctly, when the path name doesn't
exist.  Happens when the path is set to "Copy of /dev/SRC" when the
partition was newly created by a copy-paste into unallocated space
earlier in the sequence of operations now being applied.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 214255eda3 Simplify Partition object to a single path (#767842)
Change from a vector of paths to a single path member in the Partition
object.  Remove add_paths() and get_paths() methods.  Keep add_path()
and get_path().

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 1dc8a0c628 Rename Device::add_path() to set_path() (#767842)
To reflect that there is only a single path in the Device object now.
Also get rid of the now unneeded optional parameter which was only
relevant when there was a vector of paths.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 902afaa010 Simplify Device object to a single path (#767842)
Background

GParted stored a list of paths for Device and Partition objects.  It
sorted this list [1][2] and treated the first specially as that is what
get_path() returned and was used almost everywhere; with the file system
specific tools, looked up in various *_Info caches, etc.

[1] Device::add_path(), ::add_paths()
[2] Partition::add_path(), ::add_paths()

Mount point display [3] was the only bit of GParted which really worked
with the path list.  Busy file system detection [4] just used the path
provided by libparted, or for LUKS /dev/mapper/* names.  It checked that
single path against the mounted file systems found from /proc/mounts,
expanded with additional block device names when symlinks were
encountered.

[3] GParted_Core::set_mountpoints() -> set_mountpoints_helper()
[4] GParted_Core::set_device_partitions() -> is_busy()
    GParted_Core::set_device_one_partition() -> is_busy()
    GParted_Core::set_luks_partition() -> is_busy()

Having the first path, by sort order, treated specially by being used
everywhere and virtually ignoring the others was wrong, complicated to
remember and difficult code with.  As all the additional paths were
virtually unused and made no difference, remove them.  The "improved
detection of mountpoins, free space, etc.." benefit from commit [5]
doesn't seem to exist.  Therefore simplify to a single path for Device
and Partition objects.

[5] commit 6d8b169e73
    changed the way devices and partitions store their device paths.
    Instead of holding a 'realpath' and a symbolic path we store paths
    in a list.  This allows for improved detection of mountpoins, free
    space, etc..

This patch

Simplify the Device object from a vector of paths to a single path.
Remove add_paths() and get_paths() methods.  Keep add_path() and
get_path() for now.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Balázs Úr 7745abd767 Updated Hungarian translation 2016-08-04 21:59:54 +00:00
Piotr Drąg 0778e4fdd1 Add Language headers to po files
Future versions of gettext will fail if this header is missing.
2016-07-21 22:35:03 +02:00
Andika Triwidada b8de6d0006 Updated Indonesian translation 2016-07-08 12:56:16 +00:00
Tiago Santos b2a4956d77 Updated Portuguese translation 2016-07-04 14:01:27 +00:00
Natanael Copa 25209904a9 Fix sscanf modifier for long long (#768239)
POSIX says that %lld is the modifier for long long.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fscanf.html

This fixes wrong sizes with musl libc.

Bug 768239 - sizes are wrong with musl libc due to use of non-standard
             sscanf "%Ld" modifier
2016-07-01 15:37:01 +01: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
Curtis Gedak 74e0aad7a4 Append -git to version for continuing development 2016-06-13 11:04:38 -06:00
Curtis Gedak 9eb9f503db ========== gparted-0.26.1 ========== 2016-06-13 10:13:02 -06:00
Milo Casagrande 553a76abfa Updated Italian translation 2016-06-13 09:07:21 +00:00
GNOME Translation Robot a2fecf01ee Updated Scottish Gaelic translation 2016-06-11 08:02:16 +00:00
Marek Černocký 991edb9566 Updated Czech translation 2016-06-10 07:38:36 +02:00
A S Alam 7b9bf718e3 Completed Punjabi Translation 2016-06-09 15:12:12 -05:00
Daniel Șerbănescu 20706140f3 Updated Romanian translation 2016-06-09 19:42:33 +00:00
A S Alam b7613cd609 updated Punjabi Translation 2016-06-08 18:44:31 -05:00
Wolfgang Stöggl 03ad03a500 Updated German translation 2016-06-07 12:12:13 +00:00
Alexandre Franke da17e38bcd Updated French translation 2016-06-07 08:35:36 +00:00
Mike Fleetwood 3daf73a01b Prevent assert failure from OperationDelete::get_partition_new() (#767233)
Composing these operations caused GParted to abort on an assert failure:
(1) Delete an existing partition,
(2) Create a new partition,
(3) Delete new partition.

This is the equivalent issue as fixed in the previous commit, except with
the delete operation rather than the check operation:
    Prevent assert failure from OperationCheck::get_partition_new() (#767233)

    # ./gpartedbin
    ======================
    libparted : 2.4
    ======================
    **
    ERROR:OperationDelete.cc:41:virtual GParted::Partition& GParted::OperationDelete::get_partition_new(): assertion failed: (false)
    Aborted (core dumped)

    # gdb ./gpartedbin core.19232 --batch --quiet --ex backtrace -ex quit
    [New Thread 19232]
    [New Thread 19234]
    [Thread debugging using libthread_db enabled]
    Core was generated by `./gpartedbin'.
    Program terminated with signal 6, Aborted.
    #0  0x000000361f2325e5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
    #0  0x000000361f2325e5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    #1  0x000000361f233dc5 in abort () at abort.c:92
    #2  0x0000003620a67324 in g_assertion_message (domain=<value optimized out>, file=<value optimized out>, line=<value optimized out>, func=0x50fcc0 "virtual GParted::Partition& GParted::OperationDelete::get_partition_new()", message=0x1b55f60 "assertion failed: (false)") at gtestutils.c:1358
    #3  0x0000003620a678f0 in g_assertion_message_expr (domain=0x0, file=0x50fa68 "OperationDelete.cc", line=41, func=0x50fcc0 "virtual GParted::Partition& GParted::OperationDelete::get_partition_new()", expr=<value optimized out>) at gtestutils.c:1369
    #4  0x000000000049aa0d in GParted::OperationDelete::get_partition_new (this=0x1b321b0) at OperationDelete.cc:41
    #5  0x00000000004c6700 in GParted::Win_GParted::activate_delete (this=0x7ffc91403670) at Win_GParted.cc:2068
    ...

As before the crash is happened in Win_GParted::activate_delete() as it
was going through the list of operations removing those which applied to
the never created partition.  It came across the delete operation of an
existing partition and called get_partition_new().  As partition_new was
not set or used by the delete operation this asserted false and crashed
GParted.

Unlike the check operation case, the delete operation doesn't have a
partition afterwards.  (As GParted represents unallocated space with
partition objects then the delete operation could be populated with a
new partition by constructing the correctly merged unallocated space
partition object, but that is what OperationDelete::apply_to_visual()
does and having a place holder doesn't seem like the right thing to do).
Instead exclude delete operations, on existing partitions, when looking
for operations applying to this not yet created partition as they are
mutually exclusive.

Bug 767233 - GParted core dump on assert failure in
             OperationDelete::get_partition_new()
2016-06-05 13:14:34 -06:00
Mike Fleetwood 1f2a50544d Prevent assert failure from OperationCheck::get_partition_new() (#767233)
Composing these operations caused GParted to abort on an assert failure:
(1) Check an existing partition,
(2) Create a new partition,
(3) Delete new partition.

    # ./gpartedbin
    ======================
    libparted : 2.4
    ======================
    **
    ERROR:OperationCheck.cc:40:virtual GParted::Partition& GParted::OperationCheck::get_partition_new(): assertion failed: (false)
    Aborted (core dumped)

    # gdb ./gpartedbin core.8876 --batch --quiet --ex backtrace -ex quit
    [New Thread 8876]
    [New Thread 8879]
    [Thread debugging using libthread_db enabled]
    Core was generated by `./gpartedbin'.
    Program terminated with signal 6, Aborted.
    #0  0x000000361f2325e5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    64	  return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);
    #0  0x000000361f2325e5 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
    #1  0x000000361f233dc5 in abort () at abort.c:92
    #2  0x0000003620a67324 in g_assertion_message (domain=<value optimized out>, file=<value optimized out>, line=<value optimized out>, func=0x50f400 "virtual GParted::Partition& GParted::OperationCheck::get_partition_new()", message=0x1d37a00 "assertion failed: (false)") at gtestutils.c:1358
    #3  0x0000003620a678f0 in g_assertion_message_expr (domain=0x0, file=0x50f1a8 "OperationCheck.cc", line=40, func=0x50f400 "virtual GParted::Partition& GParted::OperationCheck::get_partition_new()", expr=<value optimized out>) at gtestutils.c:1369
    #4  0x0000000000498e21 in GParted::OperationCheck::get_partition_new (this=0x1d1bb30) at OperationCheck.cc:40
    #5  0x00000000004c66ec in GParted::Win_GParted::activate_delete (this=0x7fff031c3e30) at Win_GParted.cc:2068
    ...

When Win_GParted::activate_delete() was stepping through the operation
list removing operations (2 & 3 in the above recreation steps) which
related to the new partition never to be created it called
get_partition_new() on all operations in the list.  This included
calling get_partition_new() on the check operation (1 in the above
recreation steps).  As partition_new was not set or used by the check
operation get_partition_new() asserted false and crashed GParted.

Fix by populating the partition_new member in OperationCheck objects,
thus allowing get_partition_new() to be called on the object.  As a
check operation doesn't change any partition boundaries or file system
attributes, just duplicate the new partition from the original
partition.

Bug 767233 - GParted core dump on assert failure in
             OperationDelete::get_partition_new()
2016-06-05 13:14:34 -06:00
Mike Fleetwood cc7e412bc6 Only enable ext4 64bit feature when required (#766910)
E2fsprogs version 1.43 always creates 64bit ext4 file systems by default
[1][2] regardless of the partition size.  Previously it only enabled the
64bit feature when required on ext4 volumes 16 TiB and larger.  Also
note that RHEL / CentOS 7 always create 64bit ext4 file systems by
default from e2fsprogs 1.42.9 [3].

(At least some versions of) Grub 2 and syslinux boot loaders don't work
with 64bit ext4 file systems [4][5][6].  For maximum boot loader
compatibility make GParted implement what mke2fs previously did, only
setting the 64bit feature on volumes 16 TiB and larger and clearing it
otherwise.  Only applied to mkfs.ext4 version 1.42 and later.

[1] Release notes, E2fsprogs 1.43 (May 17, 2016)
    http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.43

    "Mke2fs will now create file systems with the metadata_csum and
    64bit features enabled by default".

[2] http://git.kernel.org/cgit/fs/ext2/e2fsprogs.git/commit/?id=cd27af3ecb83e8fd1e3eaa14994284a1818c7c15
    mke2fs: enable the metadata_csum and 64bit features by default

[3] Comment 20 and 21 in Red Hat bug 1099237
    https://bugzilla.redhat.com/show_bug.cgi?id=1099237#c20

    "..., is rhel7 default behavior w.r.t. 64 bit really different from
    upstream ?

    Yes it is. This is what we have in RHEL7:
    Patch6: e2fsprogs-1.42.9-enable-64bit-feature-by-default.patch
    it fixed this bz: https://bugzilla.redhat.com/show_bug.cgi?id=982871
    and this is upstream proposal:
    http://www.spinics.net/lists/linux-ext4/msg42294.html"

[4] Grub 2 not working on Slackware with 64bit EXT4
    http://www.linuxquestions.org/questions/slackware-14/grub-mkconfig-error-in-slackware-current-64-bit-4175580544/

[5] Syslinux not working on Slackware with 64bit EXT4
    http://www.linuxquestions.org/questions/slackware-14/slackware64-current-5-20-2016-syslinux-booting-and-ext4-formatting-4175580324/

[6] Syslinux not working on RHEL 7 with 64bit EXT4
    Bug 1099237 - rhel7 ext4 defaults to 64 bit, which extlinux can't reliably read
    https://bugzilla.redhat.com/show_bug.cgi?id=1099237

Bug 766910 - Multiple boot loaders don't work on 64bit EXT4 file systems
2016-06-05 09:40:11 -06:00
Mike Fleetwood a13526bf41 Don't limit ext4 volume size when 64bit feature is available (#766910)
E2fsprogs 1.42 adds ext4 64bit feature [1] allowing volume sizes larger
than 16 TiB.  However only enable large volumes from e2fsprogs 1.42.9
when a large number of 64bit bugs were fixed [2].  (Also RHEL / CentOS 7
use e2fsprogs 1.42.9 and always enable 64bit feature by default).

[1] Release notes, E2fsprogs 1.42 (November 29, 2011)
    http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.42

    "This release of e2fsprogs has support for file systems > 16TB.
    Online resize requires kernel support which will hopefully be in
    Linux version 3.2.  Offline support is not yet available for > 16TB
    file systems, but will be coming".

[2] Release notes, E2fsprogs 1.42.9 (December 28, 2013)
    http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.42.9

    "Fixed a large number of bugs in resize2fs, e2fsck, debugfs, and
    libext2fs to correctly handle bigalloc and 64-bit file systems.
    There were many corner cases that had not been noticed in previous
    uses of these file systems, since they are not as common.  Some of
    the bugs could cause file system corruption or data loss, so users
    of 64-bit or bigalloc file systems are strongly urged to upgrade to
    e2fsprogs 1.42.9".

Bug 766910 - Multiple boot loaders don't work on 64bit EXT4 file systems
2016-06-05 09:40:11 -06:00
Mike Fleetwood af17808d08 Limit maximum ext2/3/4 volume size to just less than 16 TiB (#766910)
Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks [1], ignoring ext4
with 64bit feature.  That is just under 16 TiB with a 4K block size.

    # truncate -s 16T /mnt/1/sparse.img
    # ls -l /mnt/1/sparse.img
    -rw-r--r--. 1 root root 17592186044416 May 28 19:33 /mnt/1/sparse.img
    # losetup /dev/loop0 /mnt/1/sparse.img
    # mkfs.ext3 /dev/loop0
    mke2fs 1.43 (17-May-2016)
    mkfs.ext3: Size of device (0x100000000 blocks) /dev/loop0 too big to be expressed
            in 32 bits using a blocksize of 4096.
    # losetup -d /dev/loop0
    #
    #
    # truncate -s $((16*1024**3-4))K sparse.img
    # ls -l /mnt/1/sparse.img
    -rw-r--r--. 1 root root 17592186040320 May 28 19:51 /mnt/1/sparse.img
    # losetup /dev/loop0 /mnt/1/sparse.img
    # mkfs.ext3 /dev/loop0
    mke2fs 1.43 (17-May-2016)
    Discarding device blocks: done
    Creating filesystem with 4294967295 4k blocks and 536870912 inodes
    Filesystem UUID: 9721d8d9-8711-499b-aae4-8ea4d9e16ca2
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
            2560000000, 3855122432

    Allocating group tables: done
    Writing inode tables: done
    Creating journal (32768 blocks): done
    Writing superblocks and filesystem accounting information: done

    # losetup -d /dev/loop0
    # rm /mnt/1/sparse.img

Actually limit the maximum volume size to 1 MiB less than 16 TiB for
coding reasons explained in the FIXME comment.

[1] Ext4 Disk Layout, Blocks
    https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Blocks

Bug 766910 - Multiple boot loaders don't work on 64bit EXT4 file systems
2016-06-05 09:40:11 -06:00
Enrico Nicoletto 58d409787b Updated Brazilian Portuguese translation 2016-05-30 20:28:07 +00:00
Daniel Mustieles 0cc98564cf Updated Spanish translation 2016-05-30 19:15:39 +02:00
Mike Fleetwood 3724421e30 Stop leaking PedGeometry object memory (#767009)
Calling libparted ped_geometry_new() creates a new PedGeometry object
from malloced memory, however the corresponding ped_geometry_destroy()
is never called to destroy the object and free the memory.

Perform a resize of a FAT file system when running GParted under
valgrind identifies several memory blocks leaked via ped_geometry_new()
from resize_move_filesystem_using_libparted().  One such example:

    # valgrind --track-origins=yes --leak-check=full ./gpartedbin
    ...
    ==32069== 32 bytes in 1 blocks are definitely lost in loss record 5,419 of 11,542
    ==32069==    at 0x4C29BFD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==32069==    by 0x8ECD8C5: ped_malloc (libparted.c:231)
    ==32069==    by 0x8ED23C1: ped_geometry_new (geom.c:79)
    ==32069==    by 0x4764F3: GParted::GParted_Core::resize_move_filesystem_using_libparted(GParted::Partition const&, GParted::Partition const&, GParted::OperationDetail&) (GParted_Core.cc:2666)
    ==32069==    by 0x478007: GParted::GParted_Core::resize_filesystem(GParted::Partition const&, GParted::Partition const&, GParted::OperationDetail&, bool) (GParted_Core.cc:2990)
    ==32069==    by 0x478440: GParted::GParted_Core::maximize_filesystem(GParted::Partition const&, GParted::OperationDetail&) (GParted_Core.cc:3037)
    ==32069==    by 0x4769A0: GParted::GParted_Core::resize(GParted::Partition const&, GParted::Partition const&, GParted::OperationDetail&) (GParted_Core.cc:2746)
    ==32069==    by 0x47582B: GParted::GParted_Core::resize_move(GParted::Partition const&, GParted::Partition&, GParted::OperationDetail&) (GParted_Core.cc:2457)
    ==32069==    by 0x46DDB2: GParted::GParted_Core::apply_operation_to_disk(GParted::Operation*) (GParted_Core.cc:767)
    ...

There is also a leak of a PedGeometry object from
resize_move_partition().  Fix by calling ped_geometry_destroy() to
delete all the allocated PedGeometry objects and free the memory.

Bug 767009 - PedGeometry objects are memory leaked
2016-05-30 10:59:31 -06:00