Avoid detecting exfat-utils commands as exfatprogs commands (#137)

A user had exfat-utils installed and tried to use GParted to create an
exfat file system.  GParted ran this command but it failed:
    # mkfs.exfat -L '' '/dev/sdb1'
    mkexfatfs 1.3.0
    mkfs.exfat: invalid option -- 'L'
    Usage: mkfs.exfat [-i volume-id] [-n label] [-p partition-first-sector] [-s sectors-per-cluster] [-V] <device>

The problem is that both exfat-utils and exfatprogs packages provide
mkfs.exfat and fsck.exfat commands but they have incompatible command
line options and GParted is programmed for exfatprogs.  So far GParted
just checks the executable exists, hence the mis-identification.

Reported version of exfat-utils commands:
    $ mkfs.exfat -V 2> /dev/null
    mkexfatfs 1.3.0
    Copyright (C) 2011-2018  Andrew Nayenko
    $ fsck.exfat -V 2> /dev/null
    exfatfsck 1.3.0
    Copyright (C) 2011-2018  Andrew Nayenko

Reported versions of exfatprogs commands:
    $ mkfs.exfat -V 2> /dev/null
    exfatprogs version : 1.0.4
    $ fsck.exfat -V 2> /dev/null
    exfatprogs version : 1.0.4

Fix this by only enabling exfat support also when the version string of
each command starts "exfatprogs version".  Note that this extra checking
is not needed for tune.exfat because only exfatprogs provides that
executable.

Closes #137 - Creating exfat partition with a label fails with error
This commit is contained in:
Mike Fleetwood 2021-02-02 19:29:40 +00:00 committed by Curtis Gedak
parent 2e927d4bc4
commit 4a84952058
1 changed files with 10 additions and 2 deletions

View File

@ -38,7 +38,11 @@ FS exfat::get_filesystem_support()
fs .online_read = FS::GPARTED ;
if (! Glib::find_program_in_path("mkfs.exfat").empty())
{
Utils::execute_command("mkfs.exfat -V", output, error, true);
if (output.compare(0, 18, "exfatprogs version") == 0)
fs.create = FS::EXTERNAL;
}
if (! Glib::find_program_in_path("tune.exfat").empty())
{
@ -47,7 +51,11 @@ FS exfat::get_filesystem_support()
}
if (! Glib::find_program_in_path("fsck.exfat").empty())
{
Utils::execute_command("fsck.exfat -V", output, error, true);
if (output.compare(0, 18, "exfatprogs version") == 0)
fs.check = FS::EXTERNAL;
}
return fs;
}