[gparted] Fix writing FAT16/32 FS UUID on Alpine Linux (!104)



commit 7368f55a2f6c384df0b91e42c9aae1fdb664e54a
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sun Jun 19 09:06:51 2022 +0100

    Fix writing FAT16/32 FS UUID on Alpine Linux (!104)
    
    Unit test writing FAT16/32 file system UUIDs fails on Alpine Linux like
    this:
        $ ./test_SupportedFileSystems --gtest_filter='*CreateAndWriteUUID/fat16'
        ...
        [ RUN      ] My/SupportedFileSystemsTest.CreateAndWriteUUID/fat16
        test_SupportedFileSystems.cc:616: Failure
        Value of: m_fs_object->write_uuid(m_partition, m_operation_detail)
          Actual: false
        Expected: true
        Operation details:
        mkfs.fat -F16 -v -I '/home/alpine/programming/c/gparted/tests/test_SupportedFileSystems.img'    
00:00:00  (SUCCESS)
        ...
        mlabel -s -n :: -i '/home/alpine/programming/c/gparted/tests/test_SupportedFileSystems.img'    
00:00:00  (ERROR)
    
        Mtools version 4.0.39, dated April 10th, 2022
        Usage: mlabel [-vscVn] [-N serial] drive:
    
        [  FAILED  ] My/SupportedFileSystemsTest.CreateAndWriteUUID/fat16, where GetParam() = 13 (38 ms)
    
    Using GParted on Alpine Linux to perform the same action produces the
    same error in the operation results.  Reproduce this on the command
    line:
        # mkfs.fat -F 16 -v -I /dev/sdb1
        # mlabel -s -n :: -i /dev/sdb1
        Mtools version 4.0.39, dated April 10th, 2022
        Usage: mlabel [-vscVn] [-N serial] drive:
        # echo $?
        1
    
    Again fix the same way, by moving the non-option '::' drive
    specification to the end of the command line.  Also drop the '-s' option
    as showing the current label is unrelated to writing a new UUID.
        # mdir -f -i /dev/sdb1 ::/ | grep 'Volume Serial Number is'
         Volume Serial Number is B97E-59A3
        # mlabel -n -i /dev/sdb1 ::
        # echo $?
        0
        # mdir -f -i /dev/sdb1 ::/ | grep 'Volume Serial Number is'
         Volume Serial Number is 1552-96A6
    
    Closes !104 - Add Alpine Linux CI jobs and resolve label and UUID issues
                  with FAT16/32

 src/fat16.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/fat16.cc b/src/fat16.cc
index 74c9ca52..274f1515 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -241,11 +241,11 @@ void fat16::read_uuid(Partition& partition)
 
 bool fat16::write_uuid( const Partition & partition, OperationDetail & operationdetail )
 {
-       Glib::ustring cmd = "mlabel -s -n :: -i " + Glib::shell_quote( partition.get_path() );
-
-       return ! execute_command( cmd, operationdetail, EXEC_CHECK_STATUS );
+       return ! execute_command("mlabel -n -i " + Glib::shell_quote(partition.get_path()) + " ::",
+                                operationdetail, EXEC_CHECK_STATUS);
 }
 
+
 bool fat16::create( const Partition & new_partition, OperationDetail & operationdetail )
 {
        Glib::ustring fat_size = specific_type == FS_FAT16 ? "16" : "32" ;


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