Commit Graph

2306 Commits

Author SHA1 Message Date
Curtis Gedak 4c109df9b5 Use systemctl runtime mask to prevent automounting (#701676)
With the beta release of Fedora 19, invoking gparted appears to
automatically mount partitions.  The systemd daemon appears to be
performing the automounting.  Hence use systemctl runtime mask to
prevent this automounting from occurring.

Bug #701676 - gparted doesn't inhibit systemd mounting, leading to
              potential data loss
2013-06-13 21:21:29 +01:00
Sinlu Bes 20006e1f8e Add create_with_label flag to struct FS (#701569)
It was difficult to retrieve whether a filesystem's label can be set on reformat.

The read_label flag can't be used as it decides whether to use the logic in the filesystem class
rather than the fallback in GParted::set_device_partitions, to determine the label of a partition.

The create_with_label flag is NONE for file systems that we cannot format with a
label (or that we cannot format at all).
The value is usually EXTERNAL for file systems that we can format with a label.
2013-06-09 09:50:54 -06:00
Mike Fleetwood aed1fb58cf Remove unused read-only functionality from internal block copy
The read-only functionality is unused and the readonly parameter is
always false in copy_filesystem() and copy_blocks() methods.  This has
been the case since the copy simulation was dropped by commit:

    b9b4b2e55d
    Remove simulation pass ( read test ) on move
2013-06-05 10:57:39 -06:00
Mike Fleetwood 2b51d87147 Make include guards unique (#539297)
Include guards need to be unique within GParted code and all included
library header files.
    http://en.wikipedia.org/wiki/Include_guard#Difficulties

Use this model for all include guards:
    #ifndef GPARTED_FILE_NAME_H
    #define GPARTED_FILE_NAME_H
    ...
    #endif /* GPARTED_FILE_NAME_H */

Closes Bug #539297 - Make include guards unique
2013-06-05 10:57:39 -06:00
Curtis Gedak 8ed7155e6d Set NTFS minimum partition size to 2 MiB (#697848)
The minimum NTFS volume size supported by the ntfs-3g mkntfs command
is 1 MiB.  Since 1 extra sector is required for the backup NTFS boot
sector, an NTFS partition must be at least 1 MiB plus 1 sector.

To demonstrate, create a 1 MiB unformatted partition using MiB
alignment (/dev/sdd1), and then try to format the partition as NTFS.

# mkntfs -Q -v -L "ntfs-test" /dev/sdd1
Device is too small (1023kiB).  Minimum NTFS volume size is 1MiB.

For GParted this means a minimum NTFS partition size of 2 MiB since
the smallest unit in the GUI is MiB.

Bug #697848 - Failure to Create 1 MiB NTFS Partition
2013-05-30 21:33:11 +01:00
Mike Fleetwood 28d41d0d6a Place options before device name for the ntfsresize command
Place the size and noaction options before the device name when resizing
an NTFS file system to match the order documented in the manual page.
Example fixed command:

    # ntfsresize -P --force --force -s 104857600 --no-action /dev/sda11
2013-05-29 09:50:26 -06:00
Mike Fleetwood 3461413d28 Shrink file systems to exact size (#701075)
Ext[234] file systems were being shrunk 1 KiB too small.  Ntfs and
reiserfs file systems were being shrunk 1 byte too small.  The resultant
file systems were ending up 1 block smaller than they could have been.

This looks like an accidental leftover from when GParted use to:
1) Shrink the file system 1 cylinder too small
2) Shrink the partition
3) Grow the file system to fill the partition
Relevant commit:

    d663c3c277
    removed cylindersize buffering during resize from the filesystems

Closes Bug #701075 - Setting the backup boot sector when resizing NTFS
2013-05-29 09:50:26 -06:00
Curtis Gedak e66a6525f2 Add GPLv2+ license to gparted.in script source file
Note the license text of this file differs slightly from the C++
source code license text to indicate this file is a part of GParted.

See:  https://www.gnu.org/licenses/gpl-howto.html

    For programs that are more than one file, it is better to replace
    “this program” with the name of the program, and begin the
    statement with a line saying “This file is part of NAME”.
2013-05-28 20:53:04 +01:00
Curtis Gedak 50d2ac8027 Remove GNOME SVN from message text
GNOME is now managed under git revision control (not SVN).
Also missing dependencies can be installed in many ways.
2013-05-28 20:53:04 +01:00
Curtis Gedak ce8a34715a Add GNU All-Permissive License to autogen.sh 2013-05-28 20:53:04 +01:00
Mike Fleetwood 7d6adee516 Update licensing statement in the README file
Explicitly state that GParted is licensed under the GPLv2+ and the
GParted Manual is licensed under the GFDLv1.2+.
2013-05-27 11:08:39 -06:00
Mike Fleetwood 70eda27733 Add testbuild.sh script (#699881)
For developers to build GParted in a git repository, logging the top
commit and build results to testbuild.log.  Intended for use with
git-test-sequence to verify every change of a patch set compiles, but
can be used standalone too.

Example usage:
    git-test-sequence origin/master.. testbuild.sh

Further documentation can be found on the GParted web site at page:
    Git Source Code Management
    http://www.gparted.org/git.php

Closes Bug #699881 - testbuild.sh - Builds GParted logging results
2013-05-27 11:08:39 -06:00
Dušan Kazik 9e2c52d1c7 Updated slovak translation 2013-05-25 23:57:45 +02:00
Mike Fleetwood 4cc426c6cf Only allow Undo and Apply after merging operations (#699452)
It was possible to make GParted crash by adding a label, check or new
UUID operation and then applying the operation before the view of
pending operations had finished fully opening.  The operation would be
successfully applied but GParted would crash afterwards.

The fault was that Add_Operation() still enabled the Undo and Apply
buttons and processed the GTK event loop before merging the list of
pending operations.  Faulty code flow went like this:

    activate_*()
        Add_Operation()
            Add operation to the operations[] vector
            Enable Undo and Apply buttons
            Refresh_Visual()
                Process GTK event loop
                    Process Apply button callback applying operations,
                    refreshing display and clearing operations[] vector
        Merge operations in the operations[] vector
        << Core dump here >>
            Merge_Operations()
                Refresh_Visual()

This faulty code flow came about when merging of operations was added
and it didn't appreciate that the operations[] vector could have been
processed and cleared by Add_Operations() before the merge step.
Relevant commit:

    b10349ae37
    Merge overlapping operations (#438573)

Fragment of code in the label operation case:

  2454  void Win_GParted::activate_label_partition()
  2455  {
  ...
  2472          Add_Operation( operation ) ;
  2473
  2474          // Verify if the two operations can be merged
  2475          for ( unsigned int t = 0 ; t < operations .size() - 1 ; t++ )
  2476          {
  2477              if ( operations[ t ] ->type == OPERATION_LABEL_PARTITION )
  2478              {
  2479                  if ( Merge_Operations( t, operations .size() - 1 ) )
  2480                      break;
  2481              }
  2482          }

Commentary in the crashing label operation case:

  2472  The pending operation was already applied when Add_Operation()
        returned resulting in the operations[] vector being cleared
        setting its size to 0.
  2475  The return type of operations.size() is an unsigned integral, so
        the upper limit of the for loop is t < 0UL - 1.  Assuming a
        32-bit machine that's t < 4294967295.
  2477  operations[] vector is access from out of bounds offset 0
        upwards until unallocated memory is accessed resulting in a core
        dump.

Fix this by not enabling the Undo and Apply buttons and processing the
GTK event loop until after merging of operations has been performed.
Fixed code flow goes like this:

    activate_*()
        Add_Operation()
            Add operation to the operations[] vector
        Merge operations in the operations[] vector
            Merge_Operations()
        show_operationslist()
            Enable Undo and Apply buttons
            Refresh_Visual()
                Process GTK event loop
                    Process Apply button callback applying operations,
                    refreshing display and clearing operations[] vector

Not allowing the operations list to be process until after the merge
step is the be correct ordering.  This also prevents the new operation
from flashing up in the operations list and then immediately
disappearing if merged.  In the case of adding the first operation,
delaying enabling the Undo and Apply buttons is enough as the buttons
were previously disabled preventing the operation being applied before
the merge.  In the case of adding further operations, processing of the
GTK event loop must also be delayed until after the merge to prevent the
operations being applied before the merge.  Although that window of
opportunity would only be microseconds.

Bug #699452 - Crash when applying operations before pending operations
              fully displayed
2013-05-19 13:18:25 -06:00
Curtis Gedak d9a3f879f9 Remove fat32.cc from POTFILES.in (#700228)
As part of bug 700228, the fat16 and fat32 code was combined.  As a
result, the fat32.cc file no longer exists and hence is not available
for translation.
2013-05-17 10:00:56 -06:00
Mike Fleetwood 7ede0ca3cc Pad fat16/32 file system labels with spaces (#700228)
Mlabel sometimes writes uninitialised memory at the end of the label.
This causes mlabel, and therefore GParted, to display extra junk at the
end of the label.  Depending on the bytes written GParted may also show
the following error on stdout:

    (gpartedbin:18116): glibmm-CRITICAL **:
    unhandled exception (type Glib::Error) in signal handler:
    domain: g_convert_error
    code  : 1
    what  : Invalid byte sequence in conversion input

This is caused by a bug in mlabel, believed fixed in mtools 4.0.14.
Effects at least Fedora 14, RHEL/CentOS 6.x and Debian 6.  (Use label
"1234567890" on Debian 6 to reproduce).  Reproduction steps:

    # mkdosfs -F16 /dev/sda7
    mkdosfs 3.0.9 (31 Jan 2010)
    # export MTOOLS_SKIP_CHECK=1
    # mlabel ::123456 -i /dev/sda7
    # mlabel -s :: -i /dev/sda7
     Volume label is 123456~1t

It is not possible to detect which characters are junk so they can't be
trimmed.  Instead just space pad labels so that at least newly written
labels aren't effected.  (Fat labels are space padded on the disk by
definition anyway).

Bug #700228 - FAT16/32 labels are sometimes shown corrupted
2013-05-17 09:23:56 -06:00
Mike Fleetwood 519af1a7c0 Combine duplicate code for fat16/32
There was virtually no difference between the separate modules for fat16
and fat32.  Remove module fat32 and patch fat16 to serve both file
system subtypes.  This is equivalent to what was previously done for
ext[234] by commit:

    38dc55d49c
    Combine duplicate code for ext[234]
2013-05-17 09:23:56 -06:00
Dimitris Spingos 164a005488 Updated Greek translation 2013-05-17 08:20:00 +03:00
Mike Fleetwood d6260e17b3 Rename function relay_update
Rename function to update_command_output() to better reflect that this
callback updates the UI with the latest output read from the command
being executed.

This makes more sense knowing a future change will add a separate
callback which parses the output read from the command and updates the
progress bar.  This function should be named update_command_progress().
2013-05-10 10:03:53 -06:00
Mike Fleetwood 0d52cd19d7 Rename signals update and eof
Rename the libsigc++ signals to signal_update and signal_eof to match
the naming used for signals in GParted.
    fgrep 'sigc::signal' include/*.h

Also explicitly use the emit() method rather than using the object
operator().  This again is to match the convention in GParted and make
it more obvious what is happening.
    fgrep '.emit(' include/*.h
2013-05-10 10:03:53 -06:00
Mike Fleetwood 30946cb812 Rename class utils_execute_command_status
Rename the class to CommandStatus to match the CamelCase naming used for
classes in GParted.
    fgrep class include/*.h
2013-05-10 10:03:53 -06:00
OKANO Takayoshi bbc34efd35 l10n: Update Japanese translation 2013-05-08 23:26:38 +09:00
Curtis Gedak 00960e0172 Add xdg-su to README (#699626)
Add xdg-su to list of possible programs used to acquire root
privileges in the gparted.desktop file.

Bug #699626 - Enable gparted.desktop to prompt for root on default
              openSUSE installation
2013-05-05 12:39:27 -06:00
Curtis Gedak e5a426d0b3 Add xdg-su program to gparted.desktop file (#699626)
Add xdg-su to list of graphical switch-to-root programs to be
considered for gparted.desktop file.

The openSUSE GNU/Linux distribution includes the program xdg-su by
default for graphically prompting for root privilege.

This enhancement enables a user to compile and install gparted from
source code on openSUSE and have the gparted menu entry graphically
prompt for root privilege.

Bug #699626 - Enable gparted.desktop to prompt for root on default
              openSUSE installation
2013-05-05 11:48:56 +01:00
Curtis Gedak c532db0e55 Append -git to version for continuing development 2013-04-30 10:36:02 -06:00
Curtis Gedak 24458c2224 ========== gparted-0.16.1 ========== 2013-04-30 09:17:54 -06:00
Mike Fleetwood b7b2af4f5e Fix autoconf check for set_default_icon_name method (#695279)
The autoconf check for the Gtk::Window::set_default_icon_name() method
was failing to detect its availability, but only on Ubuntu >= 11.10.

Turns out that the autoconf check incorrectly defined the link libraries
via the C++ flags variable CXXFLAGS, rather than the LIBS variable.
This resulted in the libraries being specified in the wrong order on the
command line.  The test only failed when Ubuntu also added the
"--as-needed" flag to the linker by default [1] which required the
libraries to be correctly specified at the end of the command line.

[1] Ubuntu 11.10 Release Notes, GCC 4.6 Toolchain
    https://wiki.ubuntu.com/OneiricOcelot/ReleaseNotes#GCC_4.6_Toolchain

This fixes commit:

    a042107883
    Only use Gtk::Window::set_default_icon_name method when available

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-29 15:42:18 -06:00
Phillip Susi 9475731ac8 Avoid glibmm GSource bug/crash (again) (#697727)
The previous commit missed one glibmm GSource wrapper in the form of the
io watch for the PipeCapture class.  Convert this one to use glib
directly as well.

Bug #697727 - Segfault in livecd Gparted v 0.15.0-3 when copying
              partition
2013-04-29 18:42:53 +01:00
Mike Fleetwood 1386984def Add copyright notice to PipeCapture .cc and .h files 2013-04-28 13:51:06 -06:00
Mike Fleetwood d6baac2546 Only install fallback icon when required (#695279)
Applications are moving away from storing icons in /usr/share/pixmaps,
instead preferring /usr/share/icons/hicolor/$SIZE/apps, so only install
the fallback icon when GParted requires it.

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-28 13:51:06 -06:00
Mike Fleetwood b09d6035cd Add fallback method for specifying GParted icon (#695279)
On RHEL / CentOS 5.9 GParted couldn't set an icon as the
set_default_icon_name() method is not available.  See commit [1] for
details.

Re-add the old set_icon_from_file() method as a fallback and re-install
a GParted pixmap as was used before commit [2].

Commit [1]:
    a042107883
    Only use Gtk::Window::set_default_icon_name method when available

Commit [2]:
    f5a80bc904
    Enabled GParted to use themed app icon (Tango theme)

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-28 13:51:06 -06:00
Mike Fleetwood bae9db222b Work around failure to execute commands with old glibmm (#695279)
On RHEL / CentOS 5.9 GParted failed to run any external commands and
instead reported the following warnings to the terminal:

    # src/gpartedbin
    ======================
    libparted : 1.8.1
    ======================
    Failed to change to directory '' (No such file or directory)
    Failed to change to directory '' (No such file or directory)
    Failed to change to directory '' (No such file or directory)
    ...

Utils::execute_command() and FileSystem::execute_command() passed a zero
length string for the working directory to
Glib::spawn_async_with_pipes() to mean don't change directory.  Instead
glibmm just tried to change to the directory with a zero length name.
This was fixed with glibmm >= 2.21.2 released July 2009, however RHEL /
CentOS 5.9 only has glibmm 2.12.10.

Relevant glibmm fix:
    Treat empty Glib::spawn*() working dir as unset
    https://git.gnome.org/browse/glibmm/commit/?id=8a7805cbbe6d268e975669349beb4e82d971537d

Fix by simply specifying ".", the current working directory, as the
directory to change into before executing all commands.

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-28 13:51:06 -06:00
Mike Fleetwood 5f06ea3369 Further RHEL / CentOS 5.9 compile fixes (#695279)
Glib::ustring::compose() method requires glibmm >= 2.16, but RHEL /
CentOS 5.9 only provides glibmm 2.12.  Replace with String::ucompose()
as is used everywhere else in the code.

Add missing include for kill() and SIGINT declarations.

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-28 13:51:06 -06:00
Mike Fleetwood d44971328a Recognise HFSX variant as an HFS+ file system (#698876)
Roughly HFSX is a case sensitive version of the HFS+ file system.

Parted reports such a file system as "hfsx" rather than "hfs+".

    # mkfs.hfsplus -v "case insensitive hfs+" /dev/sda7
    Initialized /dev/sda7 as a 1024 MB HFS Plus volume

    # mkfs.hfsplus -s -v "case sensitive hfs+" /dev/sda8
    Initialized /dev/sda8 as a 1024 MB HFS Plus volume

    # parted /dev/sda print
    ...
    Number  Start   End     Size    Type      File system     Flags
    ...
     7      356GB   357GB   1074MB  logical   hfs+
     8      357GB   358GB   1074MB  logical   hfsx

    # blkid /dev/sda[78]
    /dev/sda7: LABEL="case insensitive hfs+" TYPE="hfsplus"
    /dev/sda8: LABEL="case sensitive hfs+" TYPE="hfsplus"

Make GParted recognise HFSX file system variants too.

Closes Bug #698876 - GParted fails to recognize HFS+ partition (possible
                     due to disabled journaling)
2013-04-28 12:47:37 -06:00
Curtis Gedak ead2a1a53f Append -git to version for continuing development 2013-04-24 10:37:43 -06:00
Curtis Gedak 02d3d4a217 ========== gparted-0.16.0 ========== 2013-04-24 09:13:44 -06:00
Daniel Șerbănescu 6e2de3b47a Updated Romanian Translation 2013-04-22 14:42:00 +02:00
Wolfgang Stöggl 66b272f575 [l10n] Updated German documentation translation 2013-04-20 20:47:43 +02:00
Wolfgang Stöggl 27f4d5169f [l10n] Updated German translation 2013-04-20 20:43:30 +02:00
Gabor Kelemen 526a82bf30 Updated Hungarian translation 2013-04-20 00:05:42 +02:00
Milo Casagrande 3c7758aec9 [l10n] Updated Italian translation. 2013-04-19 19:18:59 +02:00
Curtis Gedak 51b8e241bc Fix gparted scans forever blank disk in virtual machine (#697518)
In some circumstances gparted would appear to scan forever if it
encountered a blank hard disk.  This would happen if the timing of
events was right and gparted encountered a disk without a partition
table.  The missing partition table would cause a call to the
exception handler, which could get stuck in a thread waiting position.

The problem was traced back to the ped_exception_handler
and a cond.signal() call missing the requisite mutex.lock() and
mutex.unlock() around the signal call.

Closes Bug #697518 - gparted scans forever blank disk in virtualbox
2013-04-19 18:02:03 +01:00
Christian Kirbach 17a51ba622 Updated German translation 2013-04-19 12:44:08 +02:00
Muhammet Kara b95c101810 l10n: Update Turkish translation 2013-04-18 21:05:47 +09:00
Claude Paroz 41706f4792 Updated French translation 2013-04-18 09:05:39 +02:00
Rafael Ferreira 633cba440d Updated Brazilian Portuguese translations 2013-04-17 22:05:38 -03:00
Phillip Susi c36934aca5 Avoid glibmm GSource bug/crash (#697727)
The glibmm GSource wrappers have a bug where they do not do
reference counting properly, and have a race condition where
the background thread can try to touch the source after the
main thread has already processed and destroyed it.  This
results in writes to freed memory and sometimes this causes
crashes or other erratic behavior.  Avoid using the glibmm
wrappers and use glib directly.  See bug #561885 for details
of the glibmm bug.

Bug #697727 - Segfault in livecd Gparted v 0.15.0-3 when copying partition
2013-04-17 11:53:55 -06:00
Mike Fleetwood 50ca2e5f13 Correctly report usage of absolutely full NTFS (#697946)
For an absolutely full NTFS GParted doesn't show the file system usage
but instead shows a warning against the partition.

GParted was looking only for "resize at %d" to determine file system
used figure in the output from the ntfsresize command.  Also handle
finding "ERROR: Volume is full" too to derive used figure.

NTFS with 1 block free case:
    # ntfsresize --info --force --no-progress-bar /dev/sda9
    ...
    Current volume size: 1073738240 bytes (1074 MB)
    ...
    Collecting resizing constraints ...
    You might resize at 1073737728 bytes (freeing 4096 bytes).
    ...
    # echo $?
    0

Absolutely full NTFS case:
    # ntfsresize --info --force --no-progress-bar /dev/sda9
    ...
    Current volume size: 1073738240 bytes (1074 MB)
    ...
    Collecting resizing constraints ...
    ERROR: Volume is full. To shrink it, delete unused files.
    # echo $?
    1

Closes Bug #697946 - Absolutely full NTFS reported as partition error
2013-04-17 10:53:09 -06:00
Nicolás Satragno 76a9cd3c93 Updated Spanish translation 2013-04-12 10:43:29 +02:00
Nicolás Satragno afbee8ae64 Updated Spanish translation 2013-04-12 10:43:13 +02:00