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



commit 7d8870d8458511a5ff016c76cf9e4076dde61714
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Jun 18 21:06:59 2022 +0100

    Fix reading FAT16/32 FS UUID on Alpine Linux (!104)
    
    Unit test reading FAT16/32 file system UUIDs fails on Alpine Linux like
    this:
        $ ./test_SupportedFileSystems --gtest_filter='*CreateAndReadUUID/fat16'
        ....
        [ RUN      ] My/SupportedFileSystemsTest.CreateAndReadUUID/fat16
        test_SupportedFileSystems.cc:581: Failure
        Expected: (m_partition.uuid.size()) >= (9U), actual: 0 vs 9
        test_SupportedFileSystems.cc:584: Failure
        Value of: m_partition.get_messages().empty()
          Actual: false
        Expected: true
        Partition messages:
        Drive '::' not supported
        Cannot initialize '::'
        Drive 'A:' not supported
        Cannot initialize 'A:'
        Drive 'A:' not supported
        Cannot initialize 'A:'
    
        [  FAILED  ] My/SupportedFileSystemsTest.CreateAndReadUUID/fat16, where GetParam() = 13 (28 ms)
    
    This doesn't normally affect GParted because it uses blkid as first
    choice to read file system UUIDs, only using file system specific
    commands when blkid isn't available.  Reproduce this on the command
    line:
        # mkfs.fat -F 16 -v -I /dev/sdb1
        # mdir -f :: -i /dev/sdb1
        Drive '::' not supported
        Cannot initialize '::'
        Drive 'A:' not supported
        Cannot initialize 'A:'
        Drive 'A:' not supported
        Cannot initialize 'A:'
    
    Again, this is caused by having non-option '::' drive specification
    before all the options on the mdir command line, which isn't supported
    by the POSIX strict getopt(3) on Alpine Linux.  Apply the same fix of
    moving the non-option argument to the end.
        # mdir -f -i /dev/sdb1 ::/
         Volume is drive : has no label
         Volume Serial Number is 7DC9-BCD9
        Director for ::/
    
        No files
        # echo $?
        0
    
    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 9b0d08f4..74c9ca52 100644
--- a/src/fat16.cc
+++ b/src/fat16.cc
@@ -222,7 +222,7 @@ bool fat16::write_label( const Partition & partition, OperationDetail & operatio
 
 void fat16::read_uuid(Partition& partition)
 {
-       exit_status = Utils::execute_command("mdir -f :: -i " + Glib::shell_quote(partition.get_path()),
+       exit_status = Utils::execute_command("mdir -f -i " + Glib::shell_quote(partition.get_path()) + " ::/",
                                             output, error, true);
        if (exit_status != 0)
        {


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