components/gparted/patches/gparted-02-bug-20239134.patch
changeset 5330 c36e3195e3e9
equal deleted inserted replaced
5328:34fe0d5ec7b7 5330:c36e3195e3e9
       
     1 # Copied over from the desktop consolidation, not for upstream
       
     2 
       
     3 --- gparted-0.4.5/src/reiserfs.cc.foo	2015-01-06 09:41:45.012380140 -0800
       
     4 +++ gparted-0.4.5/src/reiserfs.cc	2015-01-06 09:50:36.448780833 -0800
       
     5 @@ -126,7 +126,7 @@
       
     6  				partition_new .get_length(), GParted::UNIT_BYTE ) ) -1, true ) ;
       
     7  	}
       
     8  
       
     9 -	exit_status = execute_command( str_temp, operationdetail ) ;
       
    10 +	exit_status = execute_command( "sh -c '" + str_temp + "'", operationdetail );
       
    11  
       
    12  	return ( exit_status == 0 || exit_status == 256 ) ;
       
    13  }
       
    14 --- gparted-0.4.5/src/xfs.cc.foo	2015-01-06 09:41:45.012736632 -0800
       
    15 +++ gparted-0.4.5/src/xfs.cc	2015-01-06 09:50:36.449091112 -0800
       
    16 @@ -275,7 +275,7 @@
       
    17  						operationdetail .add_child( OperationDetail( _("copy file system") ) ) ;
       
    18  						
       
    19  						if ( ! execute_command( 
       
    20 -							 "xfsdump -J - " + SRC + " | xfsrestore -J - " + DST,
       
    21 +							 "sh -c 'xfsdump -J - " + SRC + " | xfsrestore -J - " + DST + "'",
       
    22  							 operationdetail .get_last_child() ) )
       
    23  						{
       
    24  							operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
       
    25 --- gparted-0.4.5/src/fat16.cc.foo	2015-01-06 09:41:45.010543338 -0800
       
    26 +++ gparted-0.4.5/src/fat16.cc	2015-01-06 09:50:36.447906092 -0800
       
    27 @@ -101,7 +101,8 @@
       
    28  	if( err_msg.length() != 0 )
       
    29  		partition .messages .push_back( err_msg );
       
    30  
       
    31 -	Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
       
    32 +	setenv( "MTOOLSRC", fname, 1 );
       
    33 +	Glib::ustring cmd = String::ucompose( "mlabel -s %1:", dletter );
       
    34  
       
    35  	if ( ! Utils::execute_command( cmd, output, error, true ) )
       
    36  	{
       
    37 @@ -128,11 +129,12 @@
       
    38  	Glib::ustring err_msg = "" ;
       
    39  	err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
       
    40  
       
    41 +	setenv( "MTOOLSRC", fname, 1 );
       
    42  	Glib::ustring cmd = "" ;
       
    43  	if( partition .label .empty() )
       
    44 -		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
       
    45 +		cmd = String::ucompose( "mlabel -c %1:", dletter );
       
    46  	else
       
    47 -		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, Utils::fat_compliant_label( partition .label ) ) ;
       
    48 +		cmd = String::ucompose( "mlabel %1:\"%2\"", dletter, Utils::fat_compliant_label( partition.label ) );
       
    49  	
       
    50  	operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
       
    51  	
       
    52 --- gparted-0.4.5/src/Utils.cc.foo	2015-01-06 09:41:45.008378779 -0800
       
    53 +++ gparted-0.4.5/src/Utils.cc	2015-01-06 09:50:36.447526098 -0800
       
    54 @@ -263,27 +263,38 @@
       
    55  
       
    56  	try
       
    57  	{
       
    58 +		const Glib::ArrayHandle< std::string >& argv = Glib::shell_parse_argv( command );
       
    59 +
       
    60  		if ( use_C_locale )
       
    61  		{
       
    62 -			std::vector<std::string> envp, argv;
       
    63 +			//Spawn command using the C language environment
       
    64 +			std::vector<std::string> envp ;
       
    65  			envp .push_back( "LC_ALL=C" ) ;
       
    66  			envp .push_back( "PATH=" + Glib::getenv( "PATH" ) ) ;
       
    67 +			envp .push_back( "MTOOLSRC=" + Glib::getenv( "MTOOLSRC" ) );
       
    68  
       
    69 -			argv .push_back( "sh" ) ;
       
    70 -			argv .push_back( "-c" ) ;
       
    71 -			argv .push_back( command ) ;
       
    72 -
       
    73 -			Glib::spawn_sync( ".",
       
    74 -					  argv,
       
    75 -					  envp,
       
    76 -					  Glib::SPAWN_SEARCH_PATH,
       
    77 -					  sigc::slot<void>(),
       
    78 -					  &std_out,
       
    79 -					  &std_error,
       
    80 -					  &exit_status ) ;
       
    81 +			Glib::spawn_sync( "."
       
    82 +			                , argv
       
    83 +			                , envp
       
    84 +			                , Glib::SPAWN_SEARCH_PATH
       
    85 +			                , sigc::slot<void>()
       
    86 +			                , &std_out
       
    87 +			                , &std_error
       
    88 +			                , &exit_status
       
    89 +			                ) ;
       
    90  		}
       
    91  		else
       
    92 -			Glib::spawn_command_line_sync( "sh -c '" + command + "'", &std_out, &std_error, &exit_status ) ;
       
    93 +		{
       
    94 +			//Spawn command inheriting the parent's environment
       
    95 +			Glib::spawn_sync( "."
       
    96 +			                , argv
       
    97 +			                , Glib::SPAWN_SEARCH_PATH
       
    98 +			                , sigc::slot<void>()
       
    99 +			                , &std_out
       
   100 +			                , &std_error
       
   101 +			                , &exit_status
       
   102 +			                ) ;
       
   103 +		}
       
   104  	}
       
   105  	catch ( Glib::Exception & e )
       
   106  	{
       
   107 --- gparted-0.4.5/src/jfs.cc.foo	2015-01-06 09:41:45.011188044 -0800
       
   108 +++ gparted-0.4.5/src/jfs.cc	2015-01-06 09:50:36.448516738 -0800
       
   109 @@ -77,7 +77,7 @@
       
   110  
       
   111  void jfs::set_used_sectors( Partition & partition ) 
       
   112  {
       
   113 -	if ( ! Utils::execute_command( "echo dm | jfs_debugfs " + partition .get_path(), output, error, true ) )
       
   114 +	if ( ! Utils::execute_command( "sh -c 'echo dm | jfs_debugfs " + partition.get_path() + "'", output, error, true ) )
       
   115  	{
       
   116  		//blocksize
       
   117  		index = output .find( "Block Size:" ) ;
       
   118 --- gparted-0.4.5/src/fat32.cc.foo	2015-01-06 09:41:45.010865773 -0800
       
   119 +++ gparted-0.4.5/src/fat32.cc	2015-01-06 09:50:36.448219811 -0800
       
   120 @@ -101,7 +101,8 @@
       
   121  	if( err_msg.length() != 0 )
       
   122  		partition .messages .push_back( err_msg );
       
   123  
       
   124 -	Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
       
   125 +	setenv( "MTOOLSRC", fname, 1 );
       
   126 +	Glib::ustring cmd = String::ucompose( "mlabel -s %1:", dletter );
       
   127  
       
   128  	if ( ! Utils::execute_command( cmd, output, error, true ) )
       
   129  	{
       
   130 @@ -128,11 +129,12 @@
       
   131  	Glib::ustring err_msg = "" ;
       
   132  	err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
       
   133  
       
   134 +	setenv( "MTOOLSRC", fname, 1 );
       
   135  	Glib::ustring cmd = "" ;
       
   136  	if( partition .label .empty() )
       
   137 -		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
       
   138 +		cmd = String::ucompose( "mlabel -c %1:", dletter );
       
   139  	else
       
   140 -		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, Utils::fat_compliant_label( partition .label ) ) ;
       
   141 +		cmd = String::ucompose( "mlabel %1:\"%2\"", dletter, Utils::fat_compliant_label( partition.label ) );
       
   142  	operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
       
   143  	
       
   144  	int exit_status = Utils::execute_command( cmd, output, error ) ;