[gparted] Time and check nearly all file system action commands (#754684)



commit 3eccd01f428723bea90db1c3917a8278d7a1d2c0
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Sep 5 09:31:16 2015 +0100

    Time and check nearly all file system action commands (#754684)
    
    There has been an undocumented rule that external commands displayed in
    the operation details, as part of file system manipulations, only get a
    time and check mark displayed when multiple commands are needed, and not
    otherwise.  (GParted checks whether all commands are successful or not
    regardless of whether a check mark is displayed in the operation details
    or not).
    
    EXCEPTION 1: btrfs resize
    
    Since the following commit [1] from 2013-02-22, GParted stopped
    displaying the timing for the btrfs resize command in the operation
    details.  It being part of a multi-command sequence to perform the step.
    This is because FileSystem::execute_command() since the commit can only
    check the exit status for zero / non-zero while timing and checking the
    command status but btrfs resize needs to consider some non-zero statuses
    as successful.
    
    [1] 52a2a9b00a32996921ace055e71d0e09fb33c5fe
        Reduce threading (#685740)
    
    EXCEPTION 2: ext2/3/4 move and copy using e2image
    
    When use of e2image was added [2] the single command steps were timed
    and check.
    
    [2] 86111fe12a26d23d9fc2a9e2d19281290ecaf985
        Use e2image to move/copy ext[234] file systems (#721516)
    
    EXCEPTION 3: fat16/32 write label and UUID
    
    Uses Utils::execute_command() rather than FileSystem::execute_command()
    so can be separately changed.  See the following commit for resolution
    of the final commands not yet timed and check mark displayed.
    
    CHANGE:
    
    Lets make a simpler rule of always displaying the time and a check mark
    for all external commands displayed in the operation details.  However
    this makes several of the other single command actions need special exit
    status handling because zero success, non-zero failure is not correct
    for every case.  Specifically affects resizing of reiserfs and check
    repair of ext2/3/4, fat16/32, jfs and reiserfs.
    
    After this change all external commands run as file system actions must
    follow one of these two patterns of using the EXEC_CHECK_STATUS flag or
    separately calling FileSystem::set_status() to register success or
    failure of the command:
        exit_status = execute_command(cmd, od, EXEC_CHECK_STATUS...);
    or:
        exit_status = execute_command(cmd, od, ...);
        bool success = (exit_status == 0 || exit_status == OTHER_SUCCESS_VALUE...);
        set_status(od, success );
    
    Bug 754684 - Updates to FileSystem:: and Utils::execute_command()
                 functions

 include/FileSystem.h |   13 ++++++-------
 src/FileSystem.cc    |    9 ++++++---
 src/btrfs.cc         |   14 ++++++++------
 src/ext2.cc          |   14 +++++++++-----
 src/f2fs.cc          |    3 ++-
 src/fat16.cc         |    7 ++++---
 src/hfs.cc           |    4 ++--
 src/hfsplus.cc       |    4 ++--
 src/jfs.cc           |   13 +++++++------
 src/linux_swap.cc    |    9 +++++----
 src/lvm2_pv.cc       |    9 +++++----
 src/nilfs2.cc        |    7 ++++---
 src/ntfs.cc          |   20 ++++++++++++--------
 src/reiser4.cc       |    6 +++---
 src/reiserfs.cc      |   17 ++++++++++-------
 src/xfs.cc           |    8 ++++----
 16 files changed, 89 insertions(+), 68 deletions(-)
---
diff --git a/include/FileSystem.h b/include/FileSystem.h
index 5c72fbf..642e29c 100644
--- a/include/FileSystem.h
+++ b/include/FileSystem.h
@@ -31,13 +31,11 @@ namespace GParted
 enum ExecFlags
 {
        EXEC_NONE         = 1 << 0,
-       EXEC_CHECK_STATUS = 1 << 1,  // Time and check exit status of the command in
-                                    // operation details.  Only used when multiple
-                                    // commands are executed in the same file system
-                                    // specific action method.  (GParted_Core displays
-                                    // the time and success of each action method in the
-                                    // parent operation detail so don't bother for single
-                                    // command file system action methods).
+       EXEC_CHECK_STATUS = 1 << 1,  // Set the status of the command in the operation
+                                    // details based on the exit status being zero or
+                                    // non-zero.  Must either use this flag when calling
+                                    // ::execute_command() or call ::set_status()
+                                    // afterwards.
        EXEC_CANCEL_SAFE  = 1 << 2
 };
 
@@ -80,6 +78,7 @@ public:
 protected:
        int execute_command( const Glib::ustring & command, OperationDetail & operationdetail,
                             ExecFlags flags = EXEC_NONE );
+       void set_status( OperationDetail & operationdetail, bool success );
        void execute_command_eof();
        Glib::ustring mk_temp_dir( const Glib::ustring & infix, OperationDetail & operationdetail ) ;
        void rm_temp_dir( const Glib::ustring dir_name, OperationDetail & operationdetail ) ;
diff --git a/src/FileSystem.cc b/src/FileSystem.cc
index a63d688..6bd0c55 100644
--- a/src/FileSystem.cc
+++ b/src/FileSystem.cc
@@ -82,9 +82,7 @@ static void setup_child()
 int FileSystem::execute_command( const Glib::ustring & command, OperationDetail & operationdetail,
                                  ExecFlags flags )
 {
-       operationdetail.add_child( OperationDetail( command,
-                                                   ( flags & EXEC_CHECK_STATUS ) ? STATUS_EXECUTE : 
STATUS_NONE,
-                                                   FONT_BOLD_ITALIC ) );
+       operationdetail.add_child( OperationDetail( command, STATUS_EXECUTE, FONT_BOLD_ITALIC ) );
        Glib::Pid pid;
        // set up pipes for capture
        int out, err;
@@ -149,6 +147,11 @@ int FileSystem::execute_command( const Glib::ustring & command, OperationDetail
        return exit_status;
 }
 
+void FileSystem::set_status( OperationDetail & operationdetail, bool success )
+{
+       operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR );
+}
+
 void FileSystem::execute_command_eof()
 {
        if (--pipecount)
diff --git a/src/btrfs.cc b/src/btrfs.cc
index 360ca23..522f7e4 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -154,12 +154,13 @@ bool btrfs::is_busy( const Glib::ustring & path )
 bool btrfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkfs.btrfs -L \"" + new_partition.get_filesystem_label() + "\" " +
-                                 new_partition.get_path(), operationdetail );
+                                 new_partition.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool btrfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return (! execute_command( "btrfsck " + partition .get_path(), operationdetail )) ;
+       return ! execute_command( "btrfsck " + partition .get_path(), operationdetail, EXEC_CHECK_STATUS );
 }
 
 void btrfs::set_used_sectors( Partition & partition )
@@ -294,7 +295,8 @@ void btrfs::set_used_sectors( Partition & partition )
 bool btrfs::write_label( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "btrfs filesystem label " + partition.get_path() +
-                                 " \"" + partition.get_filesystem_label() + "\"", operationdetail );
+                                 " \"" + partition.get_filesystem_label() + "\"",
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool btrfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -336,7 +338,7 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
                        cmd = "btrfs filesystem resize " + devid_str + ":" + size + " " + mount_point ;
                else
                        cmd = "btrfsctl -r " + devid_str + ":" + size + " " + mount_point ;
-               exit_status = execute_command( cmd, operationdetail, EXEC_NONE );
+               exit_status = execute_command( cmd, operationdetail );
                bool resize_succeeded = ( exit_status == 0 ) ;
                if ( resize_to_same_size_fails )
                {
@@ -358,7 +360,7 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
                                             || ( ! btrfs_found && exit_status ==  1<<8 )
                                           ) ;
                }
-               operationdetail .get_last_child() .set_status( resize_succeeded ? STATUS_SUCCES : 
STATUS_ERROR ) ;
+               set_status( operationdetail, resize_succeeded );
                success &= resize_succeeded ;
 
                if ( ! partition_new .busy )
@@ -432,7 +434,7 @@ void btrfs::read_uuid( Partition & partition )
 
 bool btrfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "btrfstune -f -u " + partition.get_path(), operationdetail );
+       return ! execute_command( "btrfstune -f -u " + partition.get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 void btrfs::clear_cache()
diff --git a/src/ext2.cc b/src/ext2.cc
index e4a3f64..fb96c16 100644
--- a/src/ext2.cc
+++ b/src/ext2.cc
@@ -192,7 +192,8 @@ void ext2::read_label( Partition & partition )
 bool ext2::write_label( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( label_cmd + " " + partition.get_path() +
-                                 " \"" + partition.get_filesystem_label() + "\"", operationdetail ) ;
+                                 " \"" + partition.get_filesystem_label() + "\"",
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void ext2::read_uuid( Partition & partition )
@@ -213,14 +214,15 @@ void ext2::read_uuid( Partition & partition )
 
 bool ext2::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( tune_cmd + " -U random " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( tune_cmd + " -U random " + partition .get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool ext2::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( mkfs_cmd + " -F -L \"" + new_partition.get_filesystem_label() + "\" " +
                                  new_partition.get_path(),
-                                 operationdetail, EXEC_CANCEL_SAFE );
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool ext2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -231,7 +233,7 @@ bool ext2::resize( const Partition & partition_new, OperationDetail & operationd
                str_temp += " " + Utils::num_to_str( floor( Utils::sector_to_unit(
                                        partition_new .get_sector_length(), partition_new .sector_size, 
UNIT_KIB ) ) ) + "K";
 
-       return ! execute_command( str_temp, operationdetail ) ;
+       return ! execute_command( str_temp, operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool ext2::check_repair( const Partition & partition, OperationDetail & operationdetail )
@@ -241,7 +243,9 @@ bool ext2::check_repair( const Partition & partition, OperationDetail & operatio
 
        //exitstatus 256 isn't documented, but it's returned when the 'FILE SYSTEM IS MODIFIED'
        //this is quite normal (especially after a copy) so we let the function return true...
-       return ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 ) ;
+       bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 2 || exit_status == 256 );
+       set_status( operationdetail, success );
+       return success;
 }
 
 bool ext2::move( const Partition & partition_new,
diff --git a/src/f2fs.cc b/src/f2fs.cc
index cf66bf3..84727e2 100644
--- a/src/f2fs.cc
+++ b/src/f2fs.cc
@@ -44,7 +44,8 @@ FS f2fs::get_filesystem_support()
 bool f2fs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkfs.f2fs -l \"" + new_partition.get_filesystem_label() + "\" " +
-                                 new_partition .get_path(), operationdetail );
+                                 new_partition.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 } //GParted
diff --git a/src/fat16.cc b/src/fat16.cc
index d0dd886..033b325 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -252,15 +252,16 @@ bool fat16::create( const Partition & new_partition, OperationDetail & operation
                                  pad_label( new_partition.get_filesystem_label() ) + "\" " +
                                  new_partition.get_path(),
                                  operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool fat16::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
        exit_status = execute_command( check_cmd + " -a -w -v " + partition .get_path(), operationdetail,
                                       EXEC_CANCEL_SAFE );
-
-       return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ;
+       bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 256 );
+       set_status( operationdetail, success );
+       return success;
 }
 
 //Private methods
diff --git a/src/hfs.cc b/src/hfs.cc
index 33dd12b..e413a68 100644
--- a/src/hfs.cc
+++ b/src/hfs.cc
@@ -82,13 +82,13 @@ bool hfs::create( const Partition & new_partition, OperationDetail & operationde
                cmd = "hformat " + new_partition .get_path() ;
        else
                cmd = "hformat -l \"" + new_partition.get_filesystem_label() + "\" " + 
new_partition.get_path();
-       return ! execute_command( cmd , operationdetail ) ;
+       return ! execute_command( cmd , operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool hfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
        //FIXME: find out what the returnvalue is in case of modified.. also check what the -a flag does.. 
(there is no manpage)
-       return ! execute_command( "hfsck -v " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "hfsck -v " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS );
 }
 
 } //GParted
diff --git a/src/hfsplus.cc b/src/hfsplus.cc
index 545c90e..6d04053 100644
--- a/src/hfsplus.cc
+++ b/src/hfsplus.cc
@@ -80,12 +80,12 @@ bool hfsplus::create( const Partition & new_partition, OperationDetail & operati
                cmd = "mkfs.hfsplus " + new_partition .get_path() ;
        else
                cmd = "mkfs.hfsplus -v \"" + new_partition.get_filesystem_label() + "\" " + 
new_partition.get_path();
-       return ! execute_command( cmd , operationdetail ) ;
+       return ! execute_command( cmd , operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool hfsplus::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "fsck.hfsplus -f -y " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "fsck.hfsplus -f -y " + partition.get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 } //GParted
diff --git a/src/jfs.cc b/src/jfs.cc
index b400a6c..c604d09 100644
--- a/src/jfs.cc
+++ b/src/jfs.cc
@@ -132,7 +132,7 @@ void jfs::read_label( Partition & partition )
 bool jfs::write_label( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "jfs_tune -L \"" + partition.get_filesystem_label() + "\" " + 
partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void jfs::read_uuid( Partition & partition )
@@ -153,14 +153,14 @@ void jfs::read_uuid( Partition & partition )
 
 bool jfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "jfs_tune -U random " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "jfs_tune -U random " + partition .get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 bool jfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkfs.jfs -q -L \"" + new_partition.get_filesystem_label() + "\" " +
-                                 new_partition.get_path(), operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 new_partition.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool jfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -198,8 +198,9 @@ bool jfs::check_repair( const Partition & partition, OperationDetail & operation
 {
        exit_status = execute_command( "jfs_fsck -f " + partition.get_path(), operationdetail,
                                       EXEC_CANCEL_SAFE );
-
-       return ( exit_status == 0 || exit_status == 1 ) ;
+       bool success = ( exit_status == 0 || exit_status == 1 );
+       set_status( operationdetail, success );
+       return success;
 }
 
 } //GParted
diff --git a/src/linux_swap.cc b/src/linux_swap.cc
index 902def1..1388f22 100644
--- a/src/linux_swap.cc
+++ b/src/linux_swap.cc
@@ -133,7 +133,7 @@ void linux_swap::read_label( Partition & partition )
 bool linux_swap::write_label( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "swaplabel -L \"" + partition.get_filesystem_label() + "\" " + 
partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void linux_swap::read_uuid( Partition & partition )
@@ -155,14 +155,15 @@ void linux_swap::read_uuid( Partition & partition )
 
 bool linux_swap::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "swaplabel -U \"" + Utils::generate_uuid() + "\" " + partition .get_path(), 
operationdetail ) ;
+       return ! execute_command( "swaplabel -U \"" + Utils::generate_uuid() + "\" " + partition .get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool linux_swap::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkswap -L \"" + new_partition.get_filesystem_label() + "\" " +
                                  new_partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool linux_swap::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
@@ -176,7 +177,7 @@ bool linux_swap::resize( const Partition & partition_new, OperationDetail & oper
        if ( ! partition_new .uuid .empty() )
                command +=  " -U \"" + partition_new .uuid + "\" " ;
        command += partition_new .get_path() ;
-       bool exit_status = ! execute_command( command , operationdetail .get_last_child() ) ;
+       bool exit_status = ! execute_command( command , operationdetail.get_last_child(), EXEC_CHECK_STATUS );
 
        operationdetail .get_last_child() .set_status( exit_status ? STATUS_SUCCES : STATUS_ERROR ) ;
        return exit_status ;
diff --git a/src/lvm2_pv.cc b/src/lvm2_pv.cc
index 21b412a..4d85923 100644
--- a/src/lvm2_pv.cc
+++ b/src/lvm2_pv.cc
@@ -98,7 +98,7 @@ void lvm2_pv::set_used_sectors( Partition & partition )
 
 bool lvm2_pv::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "lvm pvcreate -M 2 " + new_partition .get_path(), operationdetail ) ;
+       return ! execute_command( "lvm pvcreate -M 2 " + new_partition.get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
@@ -108,12 +108,13 @@ bool lvm2_pv::resize( const Partition & partition_new, OperationDetail & operati
                size = " --setphysicalvolumesize " +
                        Utils::num_to_str( floor( Utils::sector_to_unit(
                                partition_new .get_sector_length(), partition_new .sector_size, UNIT_KIB ) ) 
) + "K " ;
-       return ! execute_command( "lvm pvresize -v " + size + partition_new .get_path(), operationdetail ) ;
+       return ! execute_command( "lvm pvresize -v " + size + partition_new.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool lvm2_pv::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "lvm pvck -v " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "lvm pvck -v " + partition.get_path(), operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationdetail )
@@ -125,7 +126,7 @@ bool lvm2_pv::remove( const Partition & partition, OperationDetail & operationde
        else
                //Must force the removal of a PV which is a member of a VG
                cmd = "lvm pvremove --force --force --yes " + partition .get_path() ;
-       return ! execute_command( cmd, operationdetail ) ;
+       return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
 }
 
 } //GParted
diff --git a/src/nilfs2.cc b/src/nilfs2.cc
index 7aa6a03..fb83746 100644
--- a/src/nilfs2.cc
+++ b/src/nilfs2.cc
@@ -137,7 +137,7 @@ bool nilfs2::write_label( const Partition & partition, OperationDetail & operati
 {
        return ! execute_command( "nilfs-tune -L \"" + partition.get_filesystem_label() + "\" " +
                                  partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void nilfs2::read_uuid( Partition & partition )
@@ -158,14 +158,15 @@ void nilfs2::read_uuid( Partition & partition )
 
 bool nilfs2::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "nilfs-tune -U " + Utils::generate_uuid() + " " + partition .get_path(), 
operationdetail ) ;
+       return ! execute_command( "nilfs-tune -U " + Utils::generate_uuid() + " " + partition .get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool nilfs2::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkfs.nilfs2 -L \"" + new_partition.get_filesystem_label() + "\" " +
                                  new_partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool nilfs2::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition 
)
diff --git a/src/ntfs.cc b/src/ntfs.cc
index f757d9b..67680ea 100644
--- a/src/ntfs.cc
+++ b/src/ntfs.cc
@@ -175,7 +175,7 @@ bool ntfs::write_label( const Partition & partition, OperationDetail & operation
 {
        return ! execute_command( "ntfslabel --force " + partition.get_path() +
                                  " \"" + partition.get_filesystem_label() + "\"",
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void ntfs::read_uuid( Partition & partition )
@@ -185,9 +185,11 @@ void ntfs::read_uuid( Partition & partition )
 bool ntfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
        if ( partition .uuid == UUID_RANDOM_NTFS_HALF )
-               return ! execute_command( "ntfslabel --new-half-serial " + partition .get_path(), 
operationdetail ) ;
+               return ! execute_command( "ntfslabel --new-half-serial " + partition.get_path(),
+                                         operationdetail, EXEC_CHECK_STATUS );
        else
-               return ! execute_command( "ntfslabel --new-serial " + partition .get_path(), operationdetail 
) ;
+               return ! execute_command( "ntfslabel --new-serial " + partition.get_path(),
+                                         operationdetail, EXEC_CHECK_STATUS );
 
        return true ;
 }
@@ -196,7 +198,7 @@ bool ntfs::create( const Partition & new_partition, OperationDetail & operationd
 {
        return ! execute_command( "mkntfs -Q -v -F -L \"" + new_partition.get_filesystem_label() + "\" " +
                                  new_partition.get_path(),
-                                 operationdetail, EXEC_CANCEL_SAFE );
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool ntfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -213,14 +215,16 @@ bool ntfs::resize( const Partition & partition_new, OperationDetail & operationd
        //simulation..
        operationdetail .add_child( OperationDetail( _("run simulation") ) ) ;
 
-       if ( ! execute_command( cmd + " --no-action " + partition_new .get_path(), operationdetail 
.get_last_child() ) )
+       if ( ! execute_command( cmd + " --no-action " + partition_new.get_path(),
+                               operationdetail.get_last_child(), EXEC_CHECK_STATUS ) )
        {
                operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
 
                //real resize
                operationdetail .add_child( OperationDetail( _("real resize") ) ) ;
 
-               if ( ! execute_command( cmd + " " + partition_new .get_path(), operationdetail 
.get_last_child() ) )
+               if ( ! execute_command( cmd + " " + partition_new.get_path(),
+                                       operationdetail.get_last_child(), EXEC_CHECK_STATUS ) )
                {
                        operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
                        return_value = true ;
@@ -244,12 +248,12 @@ bool ntfs::copy( const Partition & src_part,
 {
        return ! execute_command( "ntfsclone -f --overwrite " + dest_part.get_path() + " " + 
src_part.get_path(),
                                  operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool ntfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "ntfsresize -i -f -v " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "ntfsresize -i -f -v " + partition.get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 } //GParted
diff --git a/src/reiser4.cc b/src/reiser4.cc
index 392aba5..c58e9d5 100644
--- a/src/reiser4.cc
+++ b/src/reiser4.cc
@@ -139,14 +139,14 @@ void reiser4::read_uuid( Partition & partition )
 bool reiser4::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkfs.reiser4 --force --yes --label \"" + 
new_partition.get_filesystem_label() + "\" " +
-                                 new_partition.get_path(), operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 new_partition.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool reiser4::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "fsck.reiser4 --yes --fix --quiet " + partition.get_path(),
-                                 operationdetail, EXEC_CANCEL_SAFE );
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 } //GParted
diff --git a/src/reiserfs.cc b/src/reiserfs.cc
index 89d6bab..536498d 100644
--- a/src/reiserfs.cc
+++ b/src/reiserfs.cc
@@ -133,7 +133,7 @@ bool reiserfs::write_label( const Partition & partition, OperationDetail & opera
 {
        return ! execute_command( "reiserfstune --label \"" + partition.get_filesystem_label() + "\" " +
                                  partition.get_path(),
-                                 operationdetail );
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 void reiserfs::read_uuid( Partition & partition )
@@ -154,14 +154,15 @@ void reiserfs::read_uuid( Partition & partition )
 
 bool reiserfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "reiserfstune -u random " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "reiserfstune -u random " + partition.get_path(),
+                                 operationdetail, EXEC_CHECK_STATUS );
 }
 
 bool reiserfs::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "mkreiserfs -f -f --label \"" + new_partition.get_filesystem_label() + "\" 
" +
                                  new_partition.get_path(),
-                                 operationdetail, EXEC_CANCEL_SAFE );
+                                 operationdetail, EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool reiserfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool 
fill_partition )
@@ -175,16 +176,18 @@ bool reiserfs::resize( const Partition & partition_new, OperationDetail & operat
        Glib::ustring cmd = "sh -c 'echo y | resize_reiserfs" + size + " " + partition_new .get_path() + "'" ;
 
        exit_status = execute_command( cmd, operationdetail ) ;
-
-       return ( exit_status == 0 || exit_status == 256 ) ;
+       bool success = ( exit_status == 0 || exit_status == 256 );
+       set_status( operationdetail, success );
+       return success;
 }
 
 bool reiserfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
        exit_status = execute_command( "reiserfsck --yes --fix-fixable --quiet " + partition.get_path(),
                                       operationdetail, EXEC_CANCEL_SAFE );
-
-       return ( exit_status == 0 || exit_status == 1 || exit_status == 256 ) ;
+       bool success = ( exit_status == 0 || exit_status == 1 || exit_status == 256 );
+       set_status( operationdetail, success );
+       return success;
 }
 
 } //GParted
diff --git a/src/xfs.cc b/src/xfs.cc
index 205af20..aa6649f 100644
--- a/src/xfs.cc
+++ b/src/xfs.cc
@@ -146,7 +146,7 @@ bool xfs::write_label( const Partition & partition, OperationDetail & operationd
                cmd = "xfs_admin -L -- " + partition .get_path() ;
        else
                cmd = "xfs_admin -L \"" + partition.get_filesystem_label() + "\" " + partition.get_path();
-       return ! execute_command( cmd, operationdetail ) ;
+       return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
 }
 
 void xfs::read_uuid( Partition & partition )
@@ -167,7 +167,7 @@ void xfs::read_uuid( Partition & partition )
 
 bool xfs::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command( "xfs_admin -U generate " + partition .get_path(), operationdetail ) ;
+       return ! execute_command( "xfs_admin -U generate " + partition.get_path(), operationdetail, 
EXEC_CHECK_STATUS );
 }
 
 bool xfs::create( const Partition & new_partition, OperationDetail & operationdetail )
@@ -175,7 +175,7 @@ bool xfs::create( const Partition & new_partition, OperationDetail & operationde
        return ! execute_command( "mkfs.xfs -f -L \"" + new_partition.get_filesystem_label() + "\" " +
                                  new_partition.get_path(),
                                  operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 bool xfs::resize( const Partition & partition_new, OperationDetail & operationdetail, bool fill_partition )
@@ -261,7 +261,7 @@ bool xfs::copy( const Partition & src_part,
 bool xfs::check_repair( const Partition & partition, OperationDetail & operationdetail )
 {
        return ! execute_command( "xfs_repair -v " + partition .get_path(), operationdetail,
-                                 EXEC_CANCEL_SAFE );
+                                 EXEC_CHECK_STATUS|EXEC_CANCEL_SAFE );
 }
 
 } //GParted


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]