[gparted] Stop using removed btrfs-show to read the label (!26)



commit 9c40b7fff0d43c7d222a26397bc8fac0d498c06d
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Mon Mar 11 21:17:43 2019 +0000

    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] eca732fb0cefe35db76a7ac96145e2004e8eed08
        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

 src/btrfs.cc | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
---
diff --git a/src/btrfs.cc b/src/btrfs.cc
index de55fc7c..f9dbe9a0 100644
--- a/src/btrfs.cc
+++ b/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:" ) ;


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