diff -u gparted-0.1/debian/changelog gparted-0.1/debian/changelog --- gparted-0.1/debian/changelog +++ gparted-0.1/debian/changelog @@ -1,3 +1,12 @@ +gparted (0.1-0ubuntu9) UNRELEASED; urgency=low + + * debian/patches/safe-apply-operations.patch: If an operation fails to + apply, cancel immediately rather than blundering on and potentially + letting later actions in the operations list damage existing filesystems + (closes: Malone #46961). + + -- Colin Watson Tue, 30 May 2006 12:21:29 +0100 + gparted (0.1-0ubuntu8) dapper; urgency=low * debian/patches/installer-mode.patch: Only emit "- FORMAT" instructions only in patch2: unchanged: --- gparted-0.1.orig/debian/patches/safe-apply-operations.patch +++ gparted-0.1/debian/patches/safe-apply-operations.patch @@ -0,0 +1,100 @@ +diff -Nur gparted-0.1/include/GParted_Core.h gparted-0.1.new/include/GParted_Core.h +--- gparted-0.1/include/GParted_Core.h 2006-05-30 12:47:00.000000000 +0100 ++++ gparted-0.1.new/include/GParted_Core.h 2006-05-30 12:47:02.000000000 +0100 +@@ -47,7 +47,7 @@ + + int get_estimated_time( const Operation & operation ) ; + +- void Apply_Operation_To_Disk( Operation & operation ); ++ bool Apply_Operation_To_Disk( Operation & operation ); + + bool Create( const Device & device, Partition & new_partition ) ; + bool format( const Partition & partition ) ; +diff -Nur gparted-0.1/src/GParted_Core.cc gparted-0.1.new/src/GParted_Core.cc +--- gparted-0.1/src/GParted_Core.cc 2006-05-30 12:47:00.000000000 +0100 ++++ gparted-0.1.new/src/GParted_Core.cc 2006-05-30 12:47:02.000000000 +0100 +@@ -507,34 +507,46 @@ + return -1 ; //pulsing + } + +-void GParted_Core::Apply_Operation_To_Disk( Operation & operation ) ++bool GParted_Core::Apply_Operation_To_Disk( Operation & operation ) + { + switch ( operation .operationtype ) + { + case DELETE: +- if ( ! Delete( operation .partition_original ) ) ++ if ( ! Delete( operation .partition_original ) ) { + Show_Error( String::ucompose( _("Error while deleting %1"), operation .partition_original .partition ) ) ; ++ return false; ++ } + + break; + case CREATE: +- if ( ! Create( operation .device, operation .partition_new ) ) ++ if ( ! Create( operation .device, operation .partition_new ) ) { + Show_Error( String::ucompose( _("Error while creating %1"), operation .partition_new .partition ) ); ++ return false; ++ } + + break; + case RESIZE_MOVE: +- if ( ! Resize( operation .device, operation .partition_original, operation .partition_new ) ) ++ if ( ! Resize( operation .device, operation .partition_original, operation .partition_new ) ) { + Show_Error( String::ucompose( _("Error while resizing/moving %1"), operation .partition_new .partition ) ) ; ++ return false; ++ } + + break; + case FORMAT: +- if ( ! format( operation .partition_new ) ) ++ if ( ! format( operation .partition_new ) ) { + Show_Error( String::ucompose( _("Error while formattting filesystem of %1"), operation .partition_new .partition ) ) ; ++ return false; ++ } + + break; + case COPY: +- if ( ! Copy( operation .copied_partition_path, operation .partition_new ) ) ++ if ( ! Copy( operation .copied_partition_path, operation .partition_new ) ) { + Show_Error( String::ucompose( _("Error while copying %1"), operation .partition_new .partition ) ) ; ++ return false; ++ } + } ++ ++ return true; + } + + bool GParted_Core::Create( const Device & device, Partition & new_partition ) +diff -Nur gparted-0.1/src/Win_GParted.cc gparted-0.1.new/src/Win_GParted.cc +--- gparted-0.1/src/Win_GParted.cc 2006-05-30 12:47:00.000000000 +0100 ++++ gparted-0.1.new/src/Win_GParted.cc 2006-05-30 12:47:38.000000000 +0100 +@@ -1489,7 +1489,7 @@ + //reread devices and their layouts... + menu_gparted_refresh_devices( ) ; + +- return true; ++ return apply; + } + else + return false; +@@ -1502,13 +1502,15 @@ + + void Win_GParted::apply_operations_thread( ) + { +- for ( unsigned int t = 0 ; t < operations .size( ) && apply ; t++ ) ++ for ( unsigned int t = 0 ; t < operations .size( ) ; t++ ) + { +- dialog_progress ->Set_Current( operations[ t ] .str_operation, +- gparted_core .get_estimated_time( operations[ t ] ) ); ++ if ( apply ) ++ dialog_progress ->Set_Current( operations[ t ] .str_operation, ++ gparted_core .get_estimated_time( operations[ t ] ) ); + dispatcher( ) ; + +- gparted_core .Apply_Operation_To_Disk( operations[ t ] ); ++ if ( apply && ! gparted_core .Apply_Operation_To_Disk( operations[ t ] ) ) ++ apply = false ; + } + dispatcher( ); + }