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
This commit is contained in:
Mike Fleetwood 2022-06-19 09:06:51 +01:00 committed by Curtis Gedak
parent 7d8870d845
commit 7368f55a2f
1 changed files with 3 additions and 3 deletions

View File

@ -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" ;