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
This commit is contained in:
Mike Fleetwood 2022-07-01 12:14:34 +01:00 committed by Curtis Gedak
parent fde76a949f
commit b7ef1688b8
1 changed files with 1 additions and 1 deletions

View File

@ -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);
}