Commit Graph

3157 Commits

Author SHA1 Message Date
Mike Fleetwood f38ccd0284 Only when configured, grant root access to the X11 display (#776437)
GParted fails to display when run under Wayland [1][2][3].  This is
because by intentional design Wayland doesn't allow applications with
root privileges access to the display [4].

As an interim workaround make the gparted shell wrapper use xhost to
grant root access to the X11 server if root doesn't already have access,
but only when configured.  Granting root access must be explicitly
enabled when building GParted like this:
    ./configure --enable-xhost-root
It defaults to disabled.  When gpartedbin binary ends the shell wrapper
revokes root access only if it granted such access.

[1] GNOME Bug 776437 - GParted fails to run as root under Wayland
    https://bugzilla.gnome.org/show_bug.cgi?id=776437

[2] Ubuntu Bug 1652282 - GParted does not work in GNOME on Wayland
    https://bugs.launchpad.net/ubuntu/+source/gparted/+bug/1652282

[3] Fedora Bug 1397103 - gparted not working under Wayland
    https://bugzilla.redhat.com/show_bug.cgi?id=1397103

[4] Common Fedora 25 bugs
    Running graphical apps with root privileges (e.g. gparted) does not
    work on Wayland
    https://fedoraproject.org/wiki/Common_F25_bugs#wayland-root-apps

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood 6f521c4d98 Remove unnecessary autoconf check for pkexec --disable-internal-agent option (#776437)
The pkexec --disable-internal-agent option was introduced by this commit
[1] in polkit 0.98 [2] which is before the minimum 0.102 version needed
to run X11 apps.  Therefore the option will always be available.  Remove
the unnecessary check.

[1] https://cgit.freedesktop.org/polkit/commit/?id=f071d4561dfe8dd9cfd4e29fddec7bc82fd658aa
    pkexec: add --disable-internal-agent option

[2] https://cgit.freedesktop.org/polkit/tree/NEWS?id=0.98#n25
    polkit NEWS entry for 0.98

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood 11c251293e Check for pkexec >= 0.102 which supports execution of X11 apps (#776437)
On CentOS 6 with polkit version 0.96 pkexec fails to execute gparted
shell wrapper as root like this:

    $ env | grep DISPLAY
    DISPLAY=:0.0
    $ sh -x /usr/local/bin/gparted
    ...
    + pkexec /usr/local/bin/gparted
    (gpartedbin:8011): Gtk-WARNING **: cannot open display:

This is because polkit didn't support setting the DISPLAY environment
variable to allow execution of X11 applications until the introduction
of the allow_gui annotation by this commit in polkit 0.102:

    https://cgit.freedesktop.org/polkit/commit/?id=7850d27017fed1834268a852350ae85381fbb110
    Bug 38769 - pkexec: Support running X11 apps

Make configure only use pkexec version 0.102 or higher as the privilege
escalation program.  Otherwise configure falls back to checking for the
other privilege escalation programs as it did before.

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood 2f559ec3b5 Only install polkit action file when pkexec is used (#776437)
Only install the GParted polkit action file when pkexec is being used as
the root privilege escalation program.

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood f35e734a0c Add required polkit action file (#776437)
An action file is always needed with polkit to describe the privileged
actions that are available to the subject (client program).  For GParted
the only available action is to run the gparted shell script as root.

Note that the polkit action file will be installed into location
$(prefix)/share/polkit-1/actions.  This is required by the GNU Coding
Standards [1] and to prevent 'make distcheck' from failing [2].  However
polkit only uses /usr/share/polkit-1/actions for it's action files [3].
This dilemma was discussed in this Bugzilla bug 776437 and on the
general Automake discussion email list [4].  The solution is to simply
document in the README file that a manual additional installation step
may be required.

The action file is marked as translatable with the underscore (_) of the
_description and _message tags identifying the string to be translated.

Use of INTLTOOL_POLICY_RULE in Makefile.am to merge translations into
the polkit action file necessitates increasing the minimum version of
intltool to 0.36.0 where it was first introduced in intltool.m4.  This
will prevent GParted building on RedHat/CentOS 5 which only has intltool
0.35.0.  But that doesn't matter because RedHat/CentOS 5 reached end of
life on 31st March 2017.

[1] GNU Coding Standards, 7.2.5 Variables for Installation Directories
    https://www.gnu.org/prep/standards/standards.html#Directory-Variables

[2] Automake Manual, 27.10 Installing to Hard-Coded Locations
    https://www.gnu.org/software/automake/manual/automake.html#Hard_002dCoded-Install-Paths
    "My package needs to populate the installation directory of another
    package at install-time.  I can easily compute that installation
    directory in configure, but if I install files therein,
    'make distcheck' fails.  How else should I do?"

[3] polkit(8), Declaring Actions
    https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html#polkit-declaring-actions

    "A mechanism need to declare a set of actions in order to use
    polkit.  Actions correspond to operations that clients can request
    the mechanism to carry out and are defined in XML files that the
    mechanism installs into the /usr/share/polkit-1/actions directory."

[4] Not installing to hard-coded locations vs polkit's fixed location
    http://lists.gnu.org/archive/html/automake/2017-08/msg00015.html

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood b47528b6f9 Add detection of pkexec root privilege escalation program (#776437)
Many of the distributions (confirmed for Arch Linux, Debian, Fedora,
OpenSUSE, RedHat/CentOS and Ubuntu but likely many others too) are now
using polkit as the mechanism to authorise privileged actions, including
using it to authorise GParted to run as root in their packages of
GParted.  Therefore make the GParted configure script check for the
pkexec command.

Use pkexec with the --disable-internal-agent option when available,
preventing pkexec using it's own textual authentication agent.  When
running GParted from a desktop icon or menu there is no terminal with
which to interact with the textual authentication agent to it can't be
used.  The desktop's graphical agent must be running.  This matches how
some distributions already use polkit in their own packages of GParted.

Required actions file will be added in the next commit.

    polkit(8)
    https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html

    pkexec(1)
    https://www.freedesktop.org/software/polkit/docs/latest/pkexec.1.html

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood 778e21e94c Now install gparted wrapper script into $prefix/bin (#776437)
Now that the gparted script is intended to be run by ordinary users, as
well as root, install it into directory $prefix/bin rather than
$prefix/sbin.

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Mike Fleetwood a2cc5014c6 Move root privilege escalation into gparted wrapper script (#776437)
Move calling of the privilege escalation program which allows a normal
user to run GParted as root from the desktop file into the gparted
wrapper script.  This is in preparation for further changes needed to
grant root access to the X11 display under Wayland.

Don't introduce yet another script so that there aren't two different
names to run GParted by for normal users and root.  Using the same
gparted name but placing two different scripts at /usr/bin/gparted and
/usr/sbin/gparted is not possible because on Arch Linux /usr/sbin is a
symbolic link to /usr/bin.

    Frequently asked questions, Does Arch follow the FHS?
    https://wiki.archlinux.org/index.php/Frequently_asked_questions#Does_Arch_follow_the_FHS.3F

    "Arch Linux follows the file system hierarchy for operating systems
    using the systemd service manager.  See file-hierarchy(7) for an
    explanation of each directory along with their designations.  In
    particular, /bin, /sbin, and /usr/sbin are symbolic links to
    /usr/bin, and /lib (and /lib64 if applicable) are symbolic links to
    /usr/lib".

Bug 776437 - GParted fails to run as root under Wayland
2017-09-01 10:14:20 -06:00
Jiri Grönroos d7fe48ed6d Update Finnish translation 2017-09-01 07:46:53 +00:00
gogo ae7cfaed61 Update Croatian translation 2017-08-20 23:00:03 +00:00
Balázs Meskó 4af15daf1f Update Hungarian translation 2017-08-17 08:20:38 +00:00
Мирослав Николић c80f9f792d Updated Serbian translation 2017-08-13 08:03:15 +02:00
Andre Klapper f164fcfcdc zh_CN: Fix keyword list which MUST end with a non-localized semicolon 2017-08-11 19:55:09 +02:00
Andre Klapper 4e08ce1e09 zh_TW: Fix keyword list which MUST end with a non-localized semicolon 2017-08-11 19:55:09 +02:00
Andre Klapper c7e0825908 en_GB: Fix keyword list which MUST end with a semicolon 2017-08-11 19:55:09 +02:00
Mike Fleetwood c353630312 Only execute mkudffs during detection when it is known to exist (#786050)
When udftools are not installed and the mkudffs program isn't found
GParted would report this error during startup:

    # ./gpartedbin
    ======================
    libparted : 3.1
    ======================
    Failed to execute child process "mkudffs" (No such file or directory)

Only run mkudffs to check for an old version when the program is found.

Bug 786050 - GParted reports failed to execute child process "mkudffs"
             when it is not installed
2017-08-10 10:04:20 -06:00
hanniedu 8a7550ffa9 Updated Dutch translation 2017-08-09 13:29:22 +02:00
Kukuh Syafaat e10c9ed3b8 Update Indonesian translation 2017-08-08 23:46:26 +00:00
Jordi Mas 40a248eed0 Update Catalan translation 2017-08-08 21:35:07 +02:00
Curtis Gedak c237a37982 Append -git to version for continuing development 2017-08-07 10:18:13 -06:00
Curtis Gedak 5b831647a8 ========== gparted-0.29.0 ========== 2017-08-07 09:59:20 -06:00
Daniel Șerbănescu ad35c3e09a Update Romanian translation 2017-08-06 09:44:17 +00:00
Daniel Șerbănescu 5d997a7d1d Update Romanian translation 2017-08-06 09:43:08 +00:00
gogo fd565b3abc Update Croatian translation 2017-08-03 20:35:08 +00:00
Alan Mortensen 8d302e855e Updated Danish translation 2017-08-03 19:47:13 +02:00
gogo 65ee7e06d7 Update Croatian translation 2017-08-03 15:53:04 +00:00
Claude Paroz 0feb38134b Updated French translation 2017-08-02 14:18:49 +02:00
Mario Blättermann cddf53f2eb Update German translation 2017-08-01 21:33:50 +00:00
Mario Blättermann 9eaf2d60e1 Update German translation 2017-08-01 21:10:38 +00:00
Marek Cernocky ec42faa205 Updated Czech translation 2017-08-01 11:14:56 +02:00
Daniel Mustieles 7e451c3da2 Update Spanish translation 2017-08-01 07:50:12 +00:00
Anders Jonsson 44416da30f Update Swedish translation 2017-07-31 22:05:22 +00:00
Baurzhan Muftakhidinov a580324af2 Update Kazakh translation 2017-07-31 17:18:37 +00:00
Piotr Drąg bca13c339c Update Polish translation 2017-07-30 15:40:37 +02:00
Mike Fleetwood a0c44d766d Refactor UDF label manipulation code (#784533)
Make especially the Volume Identifier length limit code simpler to
understand and therefore easier to maintain.

Bug 784533 - Add support for UDF file system
2017-07-30 09:50:09 +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
gogo dc31a28d4f Update Croatian translation 2017-07-25 19:13:41 +00:00
Mario Blättermann 80266e658f Update German translation 2017-07-24 15:28:31 +00:00
Mike Fleetwood 38cb6f2770 Fix make distcheck build failing with missing *.Po files (#785308)
Make distcheck is failing like:
    <snip>
    Make distcheck
    Making distclean in tests
    make[2]: Entering directory
    '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests'
    Makefile:658: ../src/.deps/BlockSpecial.Po: No such file or directory
    Makefile:659: ../src/.deps/PipeCapture.Po: No such file or directory
    make[2]: *** No rule to make target '../src/.deps/PipeCapture.Po'.  Stop.
    make[2]: Leaving directory
    '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub/tests'
    Makefile:596: recipe for target 'distclean-recursive' failed
    make[1]: *** [distclean-recursive] Error 1
    make[1]: Leaving directory
    '/home/gedakc/workspace/gparted/gparted-0.29.0-beta1/_build/sub'
    Makefile:805: recipe for target 'distcheck' failed
    make: *** [distcheck] Error 1

Make distcheck started failing like this with this commit:
    f31808989a
    Silence subdir-objects warning from automake 1.14 (#781978)

However, also need to be referring to source files from a sibling
directory like this from tests/Makefile.am:
    test_BlockSpecial_SOURCES = test_BlockSpecial.cc ../src/BlockSpecial.cc
                                                     ^^^^^^^
First introduced by this commit:
    c37be28148
    Add unit tests for BlockSpecial constructors and internal caching (#781978)

This failure, if not exactly common, has been seen a number of times
before.  Using this hint from a GNU Automake forum post:

    converting to subdir-objects
    http://gnu-automake.7480.n7.nabble.com/converting-to-subdir-objects-td21724.html

    "I had the same issue and wouldn't care unless Automake 1.15 started
    to warn about "source file in a subdirectory". In my case 'bar.o' is
    also built from 'foo/Makefile' so I decided to skip using 'bar.c' as
    SOURCE and instead link in 'foo/bar.o'.

    http://dev.thep.lu.se/svndigest/changeset/1581

    Cheers,
    Peter
    "

Fix by avoiding referring to source files from a sibling directory when
building the unit test programs, instead refer to object files instead.

Note that the automake subdir-objects option is still required to
silence the warning because of the use of source files in subdirectories
by lib/gtest/Makefile.am.

Bug 785308 - make distcheck fails with *.Po: No such file or directory
2017-07-23 09:39:52 -06:00
Piotr Drąg 400cd52b61 Update Polish translation 2017-07-16 18:41:15 +02:00
Kukuh Syafaat 2a9e18f79c Update Indonesian translation 2017-07-11 18:48:47 +00:00
Mike Fleetwood 62a7465fd2 Update AUTHORS file and Help > About > Credits
Provide credit for patch by Pali Rohár.
2017-07-10 19:17:05 +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
Pali Rohár 77ef2be089 Fix setting empty label when creating FAT16/32 file systems (#784564)
A FAT file system label in the partition boot sector should be set to
"NO NAME    " when the label is empty [1][2].  mkdosfs/mkfs.fat always
sets this to the label specified on the command line, even when the
label is blank [3].  Fix by not specifying the label when it is blank.

[1] The FAT File System, BIOS Parameter Block and Extended BIOS
    Parameter Block
    https://social.technet.microsoft.com/wiki/contents/articles/6771.the-fat-file-system.aspx#BPB_and_EBPB
[2] FAT16 File System, Volume Label
    http://www.maverick-os.dk/FileSystemFormats/FAT16_FileSystem.html#VolumeLabel
[3] mkfs.fat -n "" generates file system with invalid label
    https://github.com/dosfstools/dosfstools/issues/54

Bug 784564 - GParted calls mkfs.fat incorrectly when user does not specify label
2017-07-07 13:23:27 +01:00
Mike Fleetwood 59c8a7d6df Detect btrfstune change UUID capability again (#784467)
Btrfstune changed it's command line help output from being written on
stderr to being written on stdout in the following commit first included
in btrfs-progs 4.7.2 released 05-Sep-2016.  This breaks GParted
detection of the change UUID capability.  Found on the very latest
distributions: up to date Arch Linux and Fedora 26 Beta.  Fix this.

    https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=57d1cbd867311d99a2ae5e3cdcffd04
    btrfs-progs: print help test to stdout

Bug 784467 - No longer detecting btrfs change UUID capability
2017-07-03 09:21:50 -06:00
Mike Fleetwood f31808989a Silence subdir-objects warning from automake 1.14 (#781978)
Configuring GParted on a machine with automake >= 1.14 produces this
warning:

    $ ./autogen.sh
    ...
    lib/gtest/Makefile.am:58: warning: source file 'src/gtest-all.cc' is in a subdirectory,
    lib/gtest/Makefile.am:58: but option 'subdir-objects' is disabled
    automake: warning: possible forward-incompatibility.
    automake: At least a source file is in a subdirectory, but the 'subdir-objects'
    automake: automake option hasn't been enabled.  For now, the corresponding output
    automake: object file(s) will be placed in the top-level directory.  However,
    automake: this behaviour will change in future Automake versions: they will
    automake: unconditionally cause object files to be placed in the same subdirectory
    automake: of the corresponding sources.
    automake: You are advised to start using 'subdir-objects' option throughout your
    automake: project, to avoid future incompatibilities.
    lib/gtest/Makefile.am:60: warning: source file 'src/gtest_main.cc' is in a subdirectory,
    lib/gtest/Makefile.am:60: but option 'subdir-objects' is disabled
    lib/gtest/Makefile.am: installing './depcomp'
    tests/Makefile.am:22: warning: source file '../src/BlockSpecial.cc' is in a subdirectory,
    tests/Makefile.am:22: but option 'subdir-objects' is disabled
    tests/Makefile.am:23: warning: source file '../src/PipeCapture.cc' is in a subdirectory,
    tests/Makefile.am:23: but option 'subdir-objects' is disabled
    ...

From the automake 1.14 NEWS file:
    http://git.savannah.gnu.org/cgit/automake.git/tree/NEWS?h=v1.14#n125

    "The next major Automake version (2.0) will unconditionally activate
    the 'subdir-objects' option.  In order to smooth out the transition,
    we now give a warning (in the category 'unsupported') whenever a
    source file is present in a subdirectory but the 'subdir-object' is
    not enabled.  For example, the following usage will trigger such a
    warning:

        bin_PROGRAMS = sub/foo
        sub_foo_SOURCES = sub/main.c sub/bar.c
    "

Set the subdir-objects automake option, silencing the warning.

Bug 781978 - Add Google Test C++ test framework
2017-06-22 09:27:01 -06:00
Mike Fleetwood 87ccf060ce Ensure internal detection requires second magic when needed (#783997)
Internal file system detection is broken for detection of LVM2 PVs
because it reports finding LVM2 PV even when only the first magic is
found.  Prepare a partition like this:
    # lvm pvcreate /dev/sdb1
    # hexdump -C /dev/sdb1 > hexdump-1.txt

Clear the second magic:
    # python
    f = open("/dev/sdb1","w")
    f.seek(0x218)
    f.write("\x00"*4)
    f.close()
    quit()

    # hexdump -C /dev/sdb1 > hexdump-2.txt
    # diff -u hexdump-[12].txt
     00000200  4c 41 42 45 4c 4f 4e 45  01 00 00 00 00 00 00 00  |LABELONE........|
    -00000210  58 69 83 e1 20 00 00 00  4c 56 4d 32 20 30 30 31  |Xi.. ...LVM2 001|
    +00000210  58 69 83 e1 20 00 00 00  00 00 00 00 20 30 30 31  |Xi.. ....... 001|
                                        ^^ ^^ ^^ ^^                       ^^^^
     00000220  52 4b 31 73 50 77 49 66  6a 72 55 4c 6a 4d 30 58  |RK1sPwIfjrULjM0X|

GParted still detects this as an LVM2 PV even though lvm and blkid do
not.

Correct logic error and only perform memcmp() with the second magic when
the second signature is non-NULL.

Bug 783997 - GParted detecting LVM2 PV regardless whether second magic
             matches or not
2017-06-20 10:03:31 -06:00
Emin Tufan Çetin fb0cc58479 Update Turkish translation 2017-06-07 12:18:02 +00:00
Mike Fleetwood f8783d69bc Add PipeCapture line discipline tests
Test that backspace and carriage return are processed correctly and
Ctrl-A and Ctrl-B are skipped by PipeCapture.
2017-06-03 09:38:55 -06:00