Bug 1188553 - 'btrfs qgroup show' output changed, breaks libguestfs
Summary: 'btrfs qgroup show' output changed, breaks libguestfs
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Virtualization Tools
Classification: Community
Component: libguestfs
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Hu Tao
QA Contact:
URL:
Whiteboard:
: 1188534 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-02-03 08:59 UTC by Richard W.M. Jones
Modified: 2015-04-30 14:36 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-04-30 14:36:48 UTC
Embargoed:


Attachments (Terms of Use)
fix parsing of output of 'btrfs qgroup show' (952 bytes, patch)
2015-02-04 02:42 UTC, Hu Tao
no flags Details | Diff
patch to fix parsing of output of 'btrfs qgroup show' (1.20 KB, application/mbox)
2015-02-04 02:48 UTC, Hu Tao
no flags Details

Description Richard W.M. Jones 2015-02-03 08:59:04 UTC
Description of problem:

The output of btrfs qgroup show changed, resulting in a failure
in libguestfs.

The output is now:

  0/5           4.00KiB      4.00KiB

which doesn't match:

    if (sscanf (line, "%" SCNu64 "/%" SCNu64 " %" SCNu64 " %" SCNu64,
                &dummy1, &dummy2, &this->btrfsqgroup_rfer,
                &this->btrfsqgroup_excl) != 4) {
      reply_with_error ("cannot parse output of qgroup show command: %s", line);
      goto error;
    }

Version-Release number of selected component (if applicable):

btrfs-progs-3.18.2-1.fc22.x86_64
libguestfs 1.29.24

How reproducible:

100%

Steps to Reproduce:
1. Use btrfs-qgroup-show API, or run the tests.

Comment 1 Richard W.M. Jones 2015-02-03 10:19:59 UTC
*** Bug 1188534 has been marked as a duplicate of this bug. ***

Comment 2 Hu Tao 2015-02-04 02:42:54 UTC
Created attachment 987903 [details]
fix parsing of output of 'btrfs qgroup show'

Comment 3 Hu Tao 2015-02-04 02:48:00 UTC
Created attachment 987904 [details]
patch to fix parsing of output of 'btrfs qgroup show'

Sorry, the previous one does not have commit message edited, please use this one.

Comment 4 Richard W.M. Jones 2015-02-05 08:36:08 UTC
This breaks the old btrfs command:

libguestfs: error: btrfs_qgroup_show: /: btrfs qgroup show: unrecognized option '--raw'
usage: btrfs qgroup show -pcreFf [--sort=qgroupid,rfer,excl,max_rfer,max_excl] <path>

    Show subvolume quota groups.

    -p		print parent qgroup id
    -c		print child qgroup id
    -r		print max referenced size of qgroup
    -e		print max exclusive size of qgroup
    -F		list all qgroups which impact the given path(include ancestral qgroups)
    -f		list all qgroups which impact the given path(exclude ancestral qgroups)
    --sort=qgroupid,rfer,excl,max_rfer,max_excl
    		list qgroups in order of qgroupid,rfer,max_rfer or max_excl
    		you can use '+' or '-' in front of each item.
    		(+:ascending, -:descending, ascending default)
FAIL: test_btrfs_qgroup_show_0

-----

I think you will need to check if the --raw flag is supported.

Comment 5 Pino Toscano 2015-04-30 14:36:48 UTC
This has been fixed with
https://github.com/libguestfs/libguestfs/commit/039ba9cf19b69f9c16efc831d4a4180cc04172a4
which is in libguestfs >= 1.29.31.


Note You need to log in before you can comment on or make changes to this bug.