components/gparted/patches/gparted-02-bug-20239134.patch
changeset 5330 c36e3195e3e9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gparted/patches/gparted-02-bug-20239134.patch	Mon Jan 25 15:32:12 2016 -0800
@@ -0,0 +1,144 @@
+# Copied over from the desktop consolidation, not for upstream
+
+--- gparted-0.4.5/src/reiserfs.cc.foo	2015-01-06 09:41:45.012380140 -0800
++++ gparted-0.4.5/src/reiserfs.cc	2015-01-06 09:50:36.448780833 -0800
+@@ -126,7 +126,7 @@
+ 				partition_new .get_length(), GParted::UNIT_BYTE ) ) -1, true ) ;
+ 	}
+ 
+-	exit_status = execute_command( str_temp, operationdetail ) ;
++	exit_status = execute_command( "sh -c '" + str_temp + "'", operationdetail );
+ 
+ 	return ( exit_status == 0 || exit_status == 256 ) ;
+ }
+--- gparted-0.4.5/src/xfs.cc.foo	2015-01-06 09:41:45.012736632 -0800
++++ gparted-0.4.5/src/xfs.cc	2015-01-06 09:50:36.449091112 -0800
+@@ -275,7 +275,7 @@
+ 						operationdetail .add_child( OperationDetail( _("copy file system") ) ) ;
+ 						
+ 						if ( ! execute_command( 
+-							 "xfsdump -J - " + SRC + " | xfsrestore -J - " + DST,
++							 "sh -c 'xfsdump -J - " + SRC + " | xfsrestore -J - " + DST + "'",
+ 							 operationdetail .get_last_child() ) )
+ 						{
+ 							operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
+--- gparted-0.4.5/src/fat16.cc.foo	2015-01-06 09:41:45.010543338 -0800
++++ gparted-0.4.5/src/fat16.cc	2015-01-06 09:50:36.447906092 -0800
+@@ -101,7 +101,8 @@
+ 	if( err_msg.length() != 0 )
+ 		partition .messages .push_back( err_msg );
+ 
+-	Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
++	setenv( "MTOOLSRC", fname, 1 );
++	Glib::ustring cmd = String::ucompose( "mlabel -s %1:", dletter );
+ 
+ 	if ( ! Utils::execute_command( cmd, output, error, true ) )
+ 	{
+@@ -128,11 +129,12 @@
+ 	Glib::ustring err_msg = "" ;
+ 	err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
+ 
++	setenv( "MTOOLSRC", fname, 1 );
+ 	Glib::ustring cmd = "" ;
+ 	if( partition .label .empty() )
+-		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
++		cmd = String::ucompose( "mlabel -c %1:", dletter );
+ 	else
+-		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, Utils::fat_compliant_label( partition .label ) ) ;
++		cmd = String::ucompose( "mlabel %1:\"%2\"", dletter, Utils::fat_compliant_label( partition.label ) );
+ 	
+ 	operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
+ 	
+--- gparted-0.4.5/src/Utils.cc.foo	2015-01-06 09:41:45.008378779 -0800
++++ gparted-0.4.5/src/Utils.cc	2015-01-06 09:50:36.447526098 -0800
+@@ -263,27 +263,38 @@
+ 
+ 	try
+ 	{
++		const Glib::ArrayHandle< std::string >& argv = Glib::shell_parse_argv( command );
++
+ 		if ( use_C_locale )
+ 		{
+-			std::vector<std::string> envp, argv;
++			//Spawn command using the C language environment
++			std::vector<std::string> envp ;
+ 			envp .push_back( "LC_ALL=C" ) ;
+ 			envp .push_back( "PATH=" + Glib::getenv( "PATH" ) ) ;
++			envp .push_back( "MTOOLSRC=" + Glib::getenv( "MTOOLSRC" ) );
+ 
+-			argv .push_back( "sh" ) ;
+-			argv .push_back( "-c" ) ;
+-			argv .push_back( command ) ;
+-
+-			Glib::spawn_sync( ".",
+-					  argv,
+-					  envp,
+-					  Glib::SPAWN_SEARCH_PATH,
+-					  sigc::slot<void>(),
+-					  &std_out,
+-					  &std_error,
+-					  &exit_status ) ;
++			Glib::spawn_sync( "."
++			                , argv
++			                , envp
++			                , Glib::SPAWN_SEARCH_PATH
++			                , sigc::slot<void>()
++			                , &std_out
++			                , &std_error
++			                , &exit_status
++			                ) ;
+ 		}
+ 		else
+-			Glib::spawn_command_line_sync( "sh -c '" + command + "'", &std_out, &std_error, &exit_status ) ;
++		{
++			//Spawn command inheriting the parent's environment
++			Glib::spawn_sync( "."
++			                , argv
++			                , Glib::SPAWN_SEARCH_PATH
++			                , sigc::slot<void>()
++			                , &std_out
++			                , &std_error
++			                , &exit_status
++			                ) ;
++		}
+ 	}
+ 	catch ( Glib::Exception & e )
+ 	{
+--- gparted-0.4.5/src/jfs.cc.foo	2015-01-06 09:41:45.011188044 -0800
++++ gparted-0.4.5/src/jfs.cc	2015-01-06 09:50:36.448516738 -0800
+@@ -77,7 +77,7 @@
+ 
+ void jfs::set_used_sectors( Partition & partition ) 
+ {
+-	if ( ! Utils::execute_command( "echo dm | jfs_debugfs " + partition .get_path(), output, error, true ) )
++	if ( ! Utils::execute_command( "sh -c 'echo dm | jfs_debugfs " + partition.get_path() + "'", output, error, true ) )
+ 	{
+ 		//blocksize
+ 		index = output .find( "Block Size:" ) ;
+--- gparted-0.4.5/src/fat32.cc.foo	2015-01-06 09:41:45.010865773 -0800
++++ gparted-0.4.5/src/fat32.cc	2015-01-06 09:50:36.448219811 -0800
+@@ -101,7 +101,8 @@
+ 	if( err_msg.length() != 0 )
+ 		partition .messages .push_back( err_msg );
+ 
+-	Glib::ustring cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -s %2:", fname, dletter ) ;
++	setenv( "MTOOLSRC", fname, 1 );
++	Glib::ustring cmd = String::ucompose( "mlabel -s %1:", dletter );
+ 
+ 	if ( ! Utils::execute_command( cmd, output, error, true ) )
+ 	{
+@@ -128,11 +129,12 @@
+ 	Glib::ustring err_msg = "" ;
+ 	err_msg = Utils::create_mtoolsrc_file( fname, dletter, partition.get_path() ) ;
+ 
++	setenv( "MTOOLSRC", fname, 1 );
+ 	Glib::ustring cmd = "" ;
+ 	if( partition .label .empty() )
+-		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel -c %2:", fname, dletter ) ;
++		cmd = String::ucompose( "mlabel -c %1:", dletter );
+ 	else
+-		cmd = String::ucompose( "export MTOOLSRC=%1 && mlabel %2:\"%3\"", fname, dletter, Utils::fat_compliant_label( partition .label ) ) ;
++		cmd = String::ucompose( "mlabel %1:\"%2\"", dletter, Utils::fat_compliant_label( partition.label ) );
+ 	operationdetail .add_child( OperationDetail( cmd, STATUS_NONE, FONT_BOLD_ITALIC ) ) ;
+ 	
+ 	int exit_status = Utils::execute_command( cmd, output, error ) ;