Guys,

   I am using libparted version 1.8.8. Yes, this is an old version but I cannot 
upgrade to higher versions at present. 
   
   There seems to be a bug in function ped_disk_new(). ped_disk_new() calls 
ped_disk_new_fresh() that sets needs_clobbber = 1.
Then it calls, type->ops->read(disk). If the device has gpt partition table, 
gpt_read() will be called. gpt_read() on finding that the partition table is 
corrupt, will try to correct the partition table. So, if calls 
ped_disk_commit_to_dev().
ped_disk_commit_to_dev() checks if disk->needs_clobber is set, will try to 
remove all known partition table signatures. This is dangerous as we are 
reading the gpt partition table and at the same time trying to remove all 
signatures of supported partition tables (in case of corrupted partition 
tabel). This may lead to loss of data.

I think that in ped_disk_new(), needs_clobber should be set to 1 before reading 
the partition table. Does this sound OK ?

Any help is highly appreciated.

thanks,
rahul



_______________________________________________
bug-parted mailing list
bug-parted@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-parted

Reply via email to