Stop using removed btrfs-show to read the label (!26)
This commit [1] from btrfs-progs 3.12 removed the previously deprecated
programs btrfsctl and btrfs-show. As btrfs-progs 3.12 is now the
minimum requirement, remove support for those removed programs.
This commit is just removing the use of btrfs-show as a fallback to read
the label.
Note that 'btrfs-show /dev/PTN' didn't distinguish between a label of
"none" and no label. Hence the logic in btrfs::read_label() to do with
matching the label "none", or matching the label with or without single
quotes. Unfortunately as identified in this commit [2]
'btrfs filesystem show /dev/PTN' is subject to the same issue, but only
when the file system is mounted and only for btrfs-progs 3.12. This was
fixed by this commit [3] from btrfs-progs 3.14.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=f243fcd1b2aa55ffadfbcc032c66dedbee56e79e
Removing btrfsctl, btrfs-vol, btrfs-show
[2] eca732fb0c
Update parsing of btrfs filesystem show for the label (#733601)
[3] https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git/commit/?id=a156b967ed9bd606afa8dc402451abcf07226c17
btrfs-progs: make filesystem show by label work
Closes !26 - Remove support for btrfs-progs < 3.12
This commit is contained in:
parent
d7dbbe4979
commit
9c40b7fff0
12
src/btrfs.cc
12
src/btrfs.cc
|
@ -357,12 +357,8 @@ bool btrfs::resize( const Partition & partition_new, OperationDetail & operation
|
|||
|
||||
void btrfs::read_label( Partition & partition )
|
||||
{
|
||||
if ( btrfs_found )
|
||||
Utils::execute_command( "btrfs filesystem show " + Glib::shell_quote( partition.get_path() ),
|
||||
output, error, true );
|
||||
else
|
||||
Utils::execute_command( "btrfs-show " + Glib::shell_quote( partition.get_path() ),
|
||||
output, error, true );
|
||||
Utils::execute_command("btrfs filesystem show " + Glib::shell_quote(partition.get_path()),
|
||||
output, error, true);
|
||||
//In many cases the exit status doesn't reflect valid output or an error condition
|
||||
// so rely on parsing the output to determine success.
|
||||
|
||||
|
@ -374,8 +370,8 @@ void btrfs::read_label( Partition & partition )
|
|||
}
|
||||
else
|
||||
{
|
||||
//Try matching a label enclosed in single quotes, as used by
|
||||
// btrfs filesystem show, then without quotes, as used by btrfs-show.
|
||||
// Try matching a label enclosed in single quotes, then without quotes, to
|
||||
// handle reporting of mounted file systems by old btrfs-progs 3.12.
|
||||
Glib::ustring label = Utils::regexp_label( output, "^Label: '(.*)' uuid:" ) ;
|
||||
if ( label .empty() )
|
||||
label = Utils::regexp_label( output, "^Label: (.*) uuid:" ) ;
|
||||
|
|
Loading…
Reference in New Issue