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
This commit is contained in:
Mike Fleetwood 2022-06-18 21:06:59 +01:00 committed by Curtis Gedak
parent ff177038e5
commit 7d8870d845
1 changed files with 1 additions and 1 deletions

View File

@ -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)
{