Commit graph

3415 commits

Author SHA1 Message Date
Bernd Homuth
2f2042f3a9 Update German translation 2018-09-21 17:20:22 +00:00
Mike Fleetwood
39d3cd97c2 Disallow resizing btrfs if any of it's mount points are read-only (#10)
No other file system allows this, but btrfs allows simultaneous mounting
with different read-write permission.  Further, btrfs allows resizing
via read-write mounts, but not via read-only mounts.

    # mkfs.btrfs /dev/sdb1
    btrfs-progs v4.15.1
    ...
    Filesystem size:    512.00MiB
    ...
    Number of devices:  1
    Devices:
       ID        SIZE  PATH
        1   512.00MiB  /dev/sdb1

    # mount -o ro /dev/sdb1 /mnt/1
    # mount -o rw /dev/sdb1 /mnt/2
    # grep sdb1 /proc/mounts
    /dev/sdb1 /mnt/1 btrfs ro,relatime,space_cache,subvolid=5,subvol=/ 0 0
    /dev/sdb1 /mnt/2 btrfs rw,relatime,space_cache,subvolid=5,subvol=/ 0 0

    # btrfs filesystem resize 1:500M /mnt/1
    Resize '/mnt/1' of '1:500M'
    ERROR: unable to resize '/mnt/1': Read-only file system
    # echo $?
    1

    # btrfs file system resize 1:500M /mnt/2
    Resize '/mnt/2' of '1:500M'
    # echo $?
    0
    # btrfs filesystem show /dev/sdb1
    Label: none  uuid: 74ccd37a-e665-4f25-b77e-a305b8a025e9
            Total devices 1 FS bytes used 128.00KiB
            devid    1 size 500.00MiB used 88.00MiB path /dev/sdb1

Also with the above order of the read-only mount listed in /proc/mounts
first and the read-write mount second, GParted again allows a resize
operational to be tried, but if fails just like before:

    Grow /dev/sdb1 from 512.00 MiB to 1.0 GiB                  (ERROR)
    * calibrate /dev/sdb1                                      (SUCCESS)
    * grow partition from 512.00 MiB to 1.00 GiB               (SUCCESS)
    * grow filesystem to fill the partition                    (ERROR)
      * btrfs filesystem resize 1:max '/mnt/1'                 (ERROR)
          Resize '/mnt/1 to '1:max'
          ERROR: unable to resize '/mnt/1': Read-only file system

What happened is that the Mount_Info module only stores single read-only
flag against the mounted block device, not for each mount point, and as
the first and second sdb1 lines from /proc/mounts were processed, the
MountEntry became:

  1st)   mount_info[BS("/dev/sdb1")] -> {true , ["/mnt/1"]
  2nd)   mount_info[BS("/dev/sdb1")] -> {false, ["/mnt/1", "/mnt/2"]

So GParted thought the file system was mounted read-write, but used the
first mount point, /mnt/1, which was mounted read-only.

This is a very unusual situation so unlikely to be encountered by users.
Fix simply and safely by treating the mounted block device as mounted
read-only if any of the mount points are mounted read-only, rather than
just the last processed mount point.

Closes #10 - Gparted fails to resize btrfs partition that is mounted
             read-only
2018-09-20 16:30:15 +00:00
Mike Fleetwood
f8512506ae Prevent online resizing of file systems mounted read-only (#10)
Resizing a file system mounted read-only fails.  Example:

    # mkfs.btrfs /dev/sdb1
    # mount -o ro /dev/sdb1 /mnt/1

In GParted try to resize partition sdb1.  The operation fails like this:

    Grow /dev/sdb1 from 512.00 MiB to 1.00 GiB                 (ERROR)
    * calibrate /dev/sdb1                                      (SUCCESS)
    * grow partition from 512.00 MiB to 1.00 GiB               (SUCCESS)
    * grow filesystem to fill the partition                    (ERROR)
      * btrfs filesystem resize 1:max '/mnt/1'                 (ERROR)
          Resize '/mnt/1' of '1:max'
          ERROR: unable to resize '/mnt/1': Read-only file system

See GitLab issue for the testing results of attempting to online resize
all supporting file system while mounted read-only.  No file system
allows online resizing while mounted read-only, except for reiserfs.
    Issue #10 - Gparted fails to resize btrfs partition that is mounted
    read-only
    https://gitlab.gnome.org/GNOME/gparted/issues/10

Fix by preventing online resizing of *all* file systems mounted
read-only, including reiserfs.  Instead of displaying the resize dialog
in this case, display an information dialog explaining why the partition
can't be resized.  This is similar to what happens when attempting to
create a new partition on a disk without a partition table.  The new
dialog looks like:

    (!) Unable to resize read-only file system /dev/sdb1
        The file system can not be resized while it is mounted read-only.
        Either unmount the file system or remount it read-write.
                                                                   [ OK ]

Closes #10 - Gparted fails to resize btrfs partition that is mounted
             read-only
2018-09-20 16:30:15 +00:00
Mike Fleetwood
c82883d6a7 Add and set read-only mount flag in the Partition object (#10)
Set the partition read-only mount flag at the same time as setting the
file system mount points.

Closes #10 - Gparted fails to resize btrfs partition that is mounted
             read-only
2018-09-20 16:30:15 +00:00
Mike Fleetwood
441b39347a Add parsing of read-only mount option into mount maps (#10)
Parse file system mount options string from file and mount command
output, extracting the setting for the read-only flag and storing in the
mount maps.  Read-only flag for swap space gets the struct MountEntry
constructor default of false.

Closes #10 - Gparted fails to resize btrfs partition that is mounted
             read-only
2018-09-20 16:30:15 +00:00
Mike Fleetwood
f4994a2b63 Add read-only flag to mounted file system entries (#10)
Just updates the 2 maps in the Mount_Info module so that they also have
a read-only flag for each mount.  Ensure that when a struct MountEntry
is created the readonly bool POD (Plain Old Data) type is initialised by
the constructor.  Nothing yet sets or uses the flag.

Closes #10 - Gparted fails to resize btrfs partition that is mounted
             read-only
2018-09-20 16:30:15 +00:00
gogo
675ad142b9 Update Croatian translation 2018-09-19 12:36:48 +00:00
Mario Blättermann
1168785014 Update German translation 2018-09-18 19:50:56 +00:00
Marek Cernocky
86acdada61 Updated Czech translation 2018-09-18 08:41:44 +02: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
18bac7c927 Replace open coding FS unknown usage check in prepare_new_partition()
Back when unallocated space handling was being added, this case was not
converted from open coding to using the provided method to check for
unknown file system usage.  Specifically this commit missed using
Partition::sector_usage_known() in
Dialog_Base_Partition::prepare_new_partition():

    7ebedc4bb3
    Don't show intrinsic unallocated space (#499202)

Fix it now.
2018-09-17 15:36:09 +00:00
Mike Fleetwood
9c35d91453 Refactor get_filesystem_object()
The function was using std::map::count() [1] to test if the file system
entry existed in the map before looking up the value using
std::map::operator[] to avoid having operator[] inserting elements which
don't exist [2].

Rewrite using std::map::find() [3] so that map is only searched once,
and so that it is more obvious what is happening without having to know
the subtleties of std::map::count() and ::operator[].

[1] std::map::count()
    http://www.cplusplus.com/reference/map/map/count/

    "Searches the container for elements with a key equivalent to k and
    returns the number of matches.

    Because all elements in a map container are unique, the function can
    only return 1 (if the element is found) or zero (otherwise).
    "

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

    "If k does not match the key of any element in the container, the
    function inserts a new element with that key and returns a reference
    to its mapped value.  Notice that this always increases the
    container size by one, even if no mapped value is assigned to the
    element (the element is constructed using its default constructor).
    "

[3] std::map::find
    http://www.cplusplus.com/reference/map/map/find/

    "Searches the container for an element with a key equivalent to k
    and returns an iterator to it if found, otherwise it returns an
    iterator to map::end.
    "
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
95903efb1f Extend un/mounting and usage reporting to unsupported file systems (!13)
For unsupported (including basic supported) file systems, also record
the mount point(s) when mounted and from /etc/fstab when not.  This
allows mounted unsupported file systems to be unmounted and ones with
/etc/fstab entries to be mounted, just like fully supported file
systems.

Also for unsupported (again including basic supported) mounted file
systems query the kernel for the usage, just like is already done for
supported file systems.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood
4c3f4e3459 Correctly preview unknown FS usage when pasting into an existing partition (!13)
When previewing copying a partition of unknown file system usage into an
existing partition, the usage still shows that of the overwritten file
system.  This affects existing supported file systems EXFAT, F2FS, MINIX
and UFS and the new basic supported one too, all for which GParted can't
read the file system usage.

Handle the case of the source file system usage being unknown and
explicitly set the copied usage to unknown too.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood
f098cd414c Correctly preview unknown FS usage when pasting into a new partition (!13)
GParted previews copying a partition of unknown file system usage into a
new partition as 100% used.  This affects existing supported file
systems EXFAT, F2FS, MINIX and UFS and the new basic supported ones too,
all for which GParted can't read the file system usage.

When preparing the working new_partition object in the Copy / Paste
dialog, the maths for the known file system usage happened to convert
the figures of used = -1 and unused = -1 into set_sector_usage(-1, 0).
Those values passed to set_sector_usage() mean unable to query the file
system size so assume it fills the partition and unused is 0, hence 100%
used.

Fix this by specifically handling the copying of file systems with
unknown usage, setting the pasted file system usage to unknown too,
used = -1 and unused = -1.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood
4d6d464664 Display "other" in the File System Support dialog (!13)
To display the supported actions for all basic supported file systems to
the users.

Prepare the list of file system actions in Win_GParted because calling
get_fs() for the "other" actions requires the gparted_core object and
load_filesystems() currently doesn't have access to it.  One alternative
would have been to make get_fs() and FILESYSTEMS static members of
GParted_Core class.  Another alternative would have been to pass the
gparted_core object to load_filesystems().  The chosen way seemed
simplest.

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
7a6dfb8a62 Enable copy and move for basic supported file systems (!13)
Add copy and move supported action set for each basic supported file
system.

Closes !13 - Support copying and moving of unsupported partition content
2018-09-17 15:36:09 +00:00
Mike Fleetwood
ba79ddaf72 Limit FILESYSTEM_MAP entries to supported and basic supported FSs (!13)
Introduce a third category of basic file system support to go along with
the existing full and none.  Use the file system's entry in
FILESYSTEM_MAP to determine the level of support.  See comment in
GParted_Core::init_filesystems() for details.

Add and remove FILESYSTEM_MAP NULL pointer entries as required, so that
only the file system types intended to have basic support have such
entries.

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
Marek Cernocky
da3da5720c Updated Czech help translation 2018-09-17 14:31:54 +02:00
Alan Mortensen
1fb13c7553 Updated Danish translation 2018-09-07 22:58:04 +02:00
Marek Cernocky
5c97d03a84 Updated Czech translation 2018-09-07 08:20:29 +02:00
Anders Jonsson
63cdf35b3e Update Swedish translation 2018-09-05 22:13:15 +00:00
Efstathios Iosifidis
92d086426a Update Greek translation 2018-09-04 22:57:14 +00:00
gogo
7899d0591c Update Croatian translation 2018-09-02 20:03:44 +00:00
Rafael Fontenelle
13620df8e2 Update Brazilian Portuguese translation 2018-09-01 15:13:20 +00:00
Rafael Fontenelle
4ed62aa60f Update Brazilian Portuguese translation 2018-09-01 15:13:05 +00:00
Rafael Fontenelle
c7bd78a85c gparted.xml: closed -> closes
The Open and Close pages use third person present tense for the "Choose:" paragraph. On the Close instruction, it had "closed" next to a "refreshes". So this commit simply applies present tense to "closed".
2018-09-01 14:57:00 +00:00
Emin Tufan Çetin
6600ac0c26 Update Turkish translation 2018-08-28 08:41:44 +00:00
Kukuh Syafaat
e5adbfd6a4 Update Indonesian translation 2018-08-27 07:32:16 +00:00
Piotr Drąg
5dd0185602 Update Polish translation 2018-08-26 18:24:54 +02:00
Mario Blättermann
b1a81a23a9 Update German translation 2018-08-25 21:33:17 +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
dc80ce196a Update bug links in the UI translation files too (!11)
The translations which have been updated for the 0.32.0 release, and
since the migration to GitLab hosting, have been updated with the new
GitLab issue bug reporting URL.  Update all the remaining translation
files to match.

Closes !11 - Update bugzilla references
2018-08-24 11:32:00 +01:00
Curtis Gedak
8bc599d054 Update bug links from Bugzilla to GitLab issues (!11)
- Bugzilla has disabled reporting of new bugs.
- Existing Bugzilla bug reports permit new comments only.
- New bugs are to be created on GitLab issues.

Reference:
[GitLab] IMPORTANT: Mass migration plan
https://mail.gnome.org/archives/desktop-devel-list/2018-March/msg00023.html

Closes !11 - Update bugzilla references
2018-08-24 09:54:12 +01:00
Curtis Gedak
b574628306 Fix broken XML tag in Romanian translation of help manual 2018-08-22 11:10:05 -06:00
Curtis Gedak
9abc477cad Append -git to version for continuing development 2018-08-22 10:09:08 -06:00
Curtis Gedak
6bece0b3d7 ========== gparted-0.32.0 ========== 2018-08-22 09:46:04 -06:00
A S Alam
2a7aea0957 Update Punjabi translation 2018-08-22 00:47:32 +00:00
صفا الفليج
fc039be938 Update Arabic translation 2018-08-21 23:53:43 +00:00
Fabio Tomat
8c0b2ba712 Add Friulian translation 2018-08-20 19:02:23 +00:00
Alan Mortensen
812134eede Updated Danish translation 2018-08-20 20:26:47 +02:00
Daniel Șerbănescu
8c6f5100f2 Update Romanian translation 2018-08-19 08:55:33 +00:00
Daniel Șerbănescu
2c786bd7fb Update Romanian translation 2018-08-19 08:47:34 +00:00
Mario Blättermann
62dcf38197 Update German translation 2018-08-18 16:48:45 +00:00