[gparted] Stop clearing FAT16/32 label when setting a new UUID (!104)



commit b7ef1688b8b0ee0c89c2df32c83310eee024f9c2
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri Jul 1 12:14:34 2022 +0100

    Stop clearing FAT16/32 label when setting a new UUID (!104)
    
    Now fix the error with GParted clearing the label when setting a new
    UUID on a FAT16/32 file system.  Reproduce the issue on the command
    line:
        # mkfs.fat -F 16 -v -I -n TEST_LABEL /dev/sdb1
        # mdir -f -i /dev/sdb1 ::/
         Volume in drive : is TEST_LABEL
         Volume Serial Number is 5D4C-6E6E
        ...
        # mlabel -n -i /dev/sdb1 ::
        # mdir -f -i /dev/sdb1 ::/
         Volume in drive : has no label
         Volume Serial Number is 77BB-A883
        ...
    
    This was broken by commit "Fix writing FAT16/32 FS UUID on Alpine Linux
    (!104)" earlier in this patchset, which included this comment:
        "...  Also drop the '-s' option
        as showing the current label is unrelated to writing a new UUID."
    
    It is not mentioned in the mlabel[1] manual page that option -s is
    needed in order to avoid clearing the label when assigning a new UUID.
    Anyway add the option back.
    
    [1] mlabel(1)
        https://linux.die.net/man/1/mlabel
        "s     Shows the existing label, without prompting the user.
        n      Assigns a new (random) serial number to the disk
        "
    
    Closes !104 - Add Alpine Linux CI jobs and resolve label and UUID issues
                  with FAT16/32

 src/fat16.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/fat16.cc b/src/fat16.cc
index 274f1515..84b8dd1a 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -241,7 +241,7 @@ void fat16::read_uuid(Partition& partition)
 
 bool fat16::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       return ! execute_command("mlabel -n -i " + Glib::shell_quote(partition.get_path()) + " ::",
+       return ! execute_command("mlabel -s -n -i " + Glib::shell_quote(partition.get_path()) + " ::",
                                 operationdetail, EXEC_CHECK_STATUS);
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]