fixed bug with thousand separator (#161362). fixed bug with incorrect
* (all filesystem classes): fixed bug with thousand separator (#161362). * ext2.cc, ext3.cc: fixed bug with incorrect used/unused space after copying.
This commit is contained in:
parent
188b27bc50
commit
7d1a46f1c1
|
@ -1,3 +1,9 @@
|
||||||
|
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
|
* (all filesystem classes): fixed bug with thousand separator (#161362).
|
||||||
|
* ext2.cc,
|
||||||
|
ext3.cc: fixed bug with incorrect used/unused space after copying.
|
||||||
|
|
||||||
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
|
2004-12-15 Bart Hakvoort <gparted@users.sf.net>
|
||||||
|
|
||||||
* Added dialog (accessable from 'gparted' menu) which shows supported operations for the various filesystems.
|
* Added dialog (accessable from 'gparted' menu) which shows supported operations for the various filesystems.
|
||||||
|
|
13
src/ext2.cc
13
src/ext2.cc
|
@ -59,7 +59,7 @@ void ext2::Set_Used_Sectors( Partition & partition )
|
||||||
Sector free_blocks = -1, blocksize = -1 ;
|
Sector free_blocks = -1, blocksize = -1 ;
|
||||||
|
|
||||||
//get free blocks..
|
//get free blocks..
|
||||||
f = popen( ( "LANG=C dumpe2fs -h " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C dumpe2fs -h " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -86,7 +86,7 @@ bool ext2::Create( const Glib::ustring device_path, const Partition & new_partit
|
||||||
|
|
||||||
bool ext2::Resize( const Partition & partition_new, bool fill_partition )
|
bool ext2::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
{
|
{
|
||||||
Glib::ustring str_temp = "resize2fs " + partition_new .partition ;
|
Glib::ustring str_temp = "LC_NUMERIC=C resize2fs " + partition_new .partition ;
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
||||||
|
@ -96,7 +96,14 @@ bool ext2::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool ext2::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool ext2::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
if ( ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
||||||
|
{
|
||||||
|
Partition partition ;
|
||||||
|
partition .partition = dest_part_path ;
|
||||||
|
return Resize( partition, true ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext2::Check_Repair( const Partition & partition )
|
bool ext2::Check_Repair( const Partition & partition )
|
||||||
|
|
13
src/ext3.cc
13
src/ext3.cc
|
@ -59,7 +59,7 @@ void ext3::Set_Used_Sectors( Partition & partition )
|
||||||
Sector free_blocks = -1, blocksize = -1 ;
|
Sector free_blocks = -1, blocksize = -1 ;
|
||||||
|
|
||||||
//get free blocks..
|
//get free blocks..
|
||||||
f = popen( ( "LANG=C dumpe2fs -h " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C dumpe2fs -h " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -86,7 +86,7 @@ bool ext3::Create( const Glib::ustring device_path, const Partition & new_partit
|
||||||
|
|
||||||
bool ext3::Resize( const Partition & partition_new, bool fill_partition )
|
bool ext3::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
{
|
{
|
||||||
Glib::ustring str_temp = "resize2fs " + partition_new .partition ;
|
Glib::ustring str_temp = "LC_NUMERIC=C resize2fs " + partition_new .partition ;
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
str_temp += " " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
||||||
|
@ -96,7 +96,14 @@ bool ext3::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool ext3::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool ext3::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
if ( ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
||||||
|
{
|
||||||
|
Partition partition ;
|
||||||
|
partition .partition = dest_part_path ;
|
||||||
|
return Resize( partition, true ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ext3::Check_Repair( const Partition & partition )
|
bool ext3::Check_Repair( const Partition & partition )
|
||||||
|
|
|
@ -43,7 +43,6 @@ FS fat16::get_filesystem_support( )
|
||||||
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
if ( ! system( "which dd 1>/dev/null 2>/dev/null" ) )
|
||||||
fs .copy = true ;
|
fs .copy = true ;
|
||||||
|
|
||||||
|
|
||||||
fs .MIN = 32 ;
|
fs .MIN = 32 ;
|
||||||
fs .MAX = 4096 ;
|
fs .MAX = 4096 ;
|
||||||
|
|
||||||
|
@ -92,7 +91,7 @@ bool fat16::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool fat16::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool fat16::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
return ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fat16::Check_Repair( const Partition & partition )
|
bool fat16::Check_Repair( const Partition & partition )
|
||||||
|
|
|
@ -90,7 +90,7 @@ bool fat32::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool fat32::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool fat32::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
return ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fat32::Check_Repair( const Partition & partition )
|
bool fat32::Check_Repair( const Partition & partition )
|
||||||
|
|
|
@ -48,7 +48,7 @@ void hfs::Set_Used_Sectors( Partition & partition )
|
||||||
Glib::ustring output ;
|
Glib::ustring output ;
|
||||||
|
|
||||||
//get free bytes..
|
//get free bytes..
|
||||||
f = popen( ( "LANG=C echo 'quit' | hfs " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C echo 'quit' | hfs " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -76,7 +76,7 @@ bool hfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool hfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool hfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
return ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hfs::Check_Repair( const Partition & partition )
|
bool hfs::Check_Repair( const Partition & partition )
|
||||||
|
|
|
@ -86,12 +86,14 @@ bool jfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool jfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool jfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
if ( ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
if ( ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
||||||
{
|
{
|
||||||
Partition partition ;
|
Partition partition ;
|
||||||
partition .partition = dest_part_path ;
|
partition .partition = dest_part_path ;
|
||||||
return Resize( partition, true ) ;
|
return Resize( partition, true ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool jfs::Check_Repair( const Partition & partition )
|
bool jfs::Check_Repair( const Partition & partition )
|
||||||
|
|
|
@ -83,7 +83,7 @@ bool linux_swap::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool linux_swap::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool linux_swap::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
return ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
return ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool linux_swap::Check_Repair( const Partition & partition )
|
bool linux_swap::Check_Repair( const Partition & partition )
|
||||||
|
|
18
src/ntfs.cc
18
src/ntfs.cc
|
@ -59,7 +59,7 @@ void ntfs::Set_Used_Sectors( Partition & partition )
|
||||||
Glib::ustring output ;
|
Glib::ustring output ;
|
||||||
|
|
||||||
//get free sectors..
|
//get free sectors..
|
||||||
f = popen( ( "LANG=C ntfscluster --force " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C ntfscluster --force " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -81,7 +81,7 @@ bool ntfs::Create( const Glib::ustring device_path, const Partition & new_partit
|
||||||
|
|
||||||
bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
{
|
{
|
||||||
Glib::ustring str_temp = "echo y | ntfsresize -f " + partition_new .partition ;
|
Glib::ustring str_temp = "LC_NUMERIC=C echo y | ntfsresize -f " + partition_new .partition ;
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
||||||
|
@ -91,19 +91,21 @@ bool ntfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool ntfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool ntfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
bool ret_val = ! Execute_Command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path ) ;
|
if ( ! Execute_Command( "ntfsclone -f --overwrite " + dest_part_path + " " + src_part_path ) )
|
||||||
|
{
|
||||||
|
Partition partition ;
|
||||||
|
partition .partition = dest_part_path ;
|
||||||
|
return Resize( partition, true ) ;
|
||||||
|
}
|
||||||
|
|
||||||
//resize to full to set correct used/unused
|
return false ;
|
||||||
Execute_Command( "echo y | ntfsresize -f " + dest_part_path ) ;
|
|
||||||
|
|
||||||
return ret_val ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntfs::Check_Repair( const Partition & partition )
|
bool ntfs::Check_Repair( const Partition & partition )
|
||||||
{
|
{
|
||||||
//according to Szaka it's best to use ntfsresize to check the partition for errors
|
//according to Szaka it's best to use ntfsresize to check the partition for errors
|
||||||
//since --info is read-only i'll leave it out. just calling ntfsresize --force has also a tendency of fixing stuff :)
|
//since --info is read-only i'll leave it out. just calling ntfsresize --force has also a tendency of fixing stuff :)
|
||||||
return ! Execute_Command( "echo y | ntfsresize -f " + partition .partition ) ;
|
return Resize( partition, true ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ntfs::get_estimated_time( long MB_to_Consider )
|
int ntfs::get_estimated_time( long MB_to_Consider )
|
||||||
|
|
|
@ -63,7 +63,7 @@ void reiserfs::Set_Used_Sectors( Partition & partition )
|
||||||
Sector free_blocks = -1, blocksize = -1 ;
|
Sector free_blocks = -1, blocksize = -1 ;
|
||||||
|
|
||||||
//get free blocks..
|
//get free blocks..
|
||||||
f = popen( ( "LANG=C debugreiserfs " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C debugreiserfs " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -89,7 +89,7 @@ bool reiserfs::Create( const Glib::ustring device_path, const Partition & new_pa
|
||||||
|
|
||||||
bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
{
|
{
|
||||||
Glib::ustring str_temp = "echo y | resize_reiserfs " + partition_new .partition ;
|
Glib::ustring str_temp = "LC_NUMERIC=C echo y | resize_reiserfs " + partition_new .partition ;
|
||||||
|
|
||||||
if ( ! fill_partition )
|
if ( ! fill_partition )
|
||||||
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
str_temp += " -s " + num_to_str( partition_new .Get_Length_MB( ) - cylinder_size ) + "M" ;
|
||||||
|
@ -99,19 +99,20 @@ bool reiserfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool reiserfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool reiserfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
//copy partition
|
if ( ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
||||||
bool ret_val = ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) ;
|
{
|
||||||
|
Partition partition ;
|
||||||
|
partition .partition = dest_part_path ;
|
||||||
|
return Resize( partition, true ) ;
|
||||||
|
}
|
||||||
|
|
||||||
//and set proper used/unused
|
return false ;
|
||||||
Execute_Command( "resize_reiserfs " + dest_part_path ) ;
|
|
||||||
|
|
||||||
return ret_val ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool reiserfs::Check_Repair( const Partition & partition )
|
bool reiserfs::Check_Repair( const Partition & partition )
|
||||||
{
|
{
|
||||||
//according to the manpage it should return 0 or 1 on succes, instead it returns 256 on succes..
|
//according to the manpage it should return 0 or 1 on succes, instead it returns 256 on succes..
|
||||||
//blah, don't have time for this. Just check for both options, we'll fix this in 0.0.8 with our much improved errorhandling
|
//blah, don't have time for this. Just check for both options, we'll fix this later with our much improved errorhandling
|
||||||
int t = Execute_Command( "reiserfsck -y --fix-fixable " + partition .partition ) ;
|
int t = Execute_Command( "reiserfsck -y --fix-fixable " + partition .partition ) ;
|
||||||
|
|
||||||
return ( t <= 1 || t == 256 ) ;
|
return ( t <= 1 || t == 256 ) ;
|
||||||
|
|
|
@ -68,7 +68,7 @@ void xfs::Set_Used_Sectors( Partition & partition )
|
||||||
Sector free_blocks = -1, blocksize = -1 ;
|
Sector free_blocks = -1, blocksize = -1 ;
|
||||||
|
|
||||||
//get free blocks..
|
//get free blocks..
|
||||||
f = popen( ( "LANG=C xfs_db -c 'sb 0' -c print -r " + partition .partition ) .c_str( ), "r" ) ;
|
f = popen( ( "LC_ALL=C xfs_db -c 'sb 0' -c print -r " + partition .partition ) .c_str( ), "r" ) ;
|
||||||
while ( fgets( c_buf, 512, f ) )
|
while ( fgets( c_buf, 512, f ) )
|
||||||
{
|
{
|
||||||
output = Glib::locale_to_utf8( c_buf ) ;
|
output = Glib::locale_to_utf8( c_buf ) ;
|
||||||
|
@ -111,7 +111,7 @@ bool xfs::Resize( const Partition & partition_new, bool fill_partition )
|
||||||
|
|
||||||
bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
bool xfs::Copy( const Glib::ustring & src_part_path, const Glib::ustring & dest_part_path )
|
||||||
{
|
{
|
||||||
if ( ! Execute_Command( "dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
if ( ! Execute_Command( "LC_NUMERIC=C dd bs=8192 if=" + src_part_path + " of=" + dest_part_path ) )
|
||||||
{
|
{
|
||||||
Partition partition ;
|
Partition partition ;
|
||||||
partition .partition = dest_part_path ;
|
partition .partition = dest_part_path ;
|
||||||
|
|
Loading…
Reference in New Issue