Bug 110181 - btrfs-show(8) inconsistency: double dash
Summary: btrfs-show(8) inconsistency: double dash
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: btrfs (show other bugs)
Hardware: All Linux
: P1 enhancement
Assignee: Josef Bacik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-30 22:20 UTC by moviuro+kernel
Modified: 2016-01-18 17:35 UTC (History)
2 users (show)

See Also:
Kernel Version: all
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description moviuro+kernel 2015-12-30 22:20:02 UTC
The btrfs-show(8) command does not consider '--' to be the end of arguments.
For the sake of consistency and future enhancements, it should.

Behavior:
# btrfs subvolume show -- /
btrfs subvolume show: too many arguments
usage: btrfs subvolume show <subvol-path>

    Show more information of the subvolume

Expected Behavior:
# btrfs subvolume show -- /
/
        Name:                   root
        UUID:                   814a917c-c11f-eb4d-b7a4-94699bd37afb
        Parent UUID:            8d1737f8-2e1f-4047-9300-1b87e02445c8
[...]

I can't write C code yet, so I can't help with enhancing the code directly and sending patches.
Comment 1 David Sterba 2016-01-13 14:21:41 UTC
As the command does not take any parameters it does not parse the command line via getopt, which handles "--". Fix on the way.
Comment 2 David Sterba 2016-01-13 14:41:06 UTC
Patch in devel, will be released in 4.4.
Comment 3 David Sterba 2016-01-13 15:40:27 UTC
There are way more commands that do not understand "--". The code for that is simple and can be copied from https://github.com/kdave/btrfs-progs/commit/dc361b45aced1982485ced74cd80476811ff0fa3 if you'd like to do that. Search for all command callbacks (start with cmd_ in the cmds-*.c files) that do not use getopt.
Comment 4 moviuro+kernel 2016-01-13 16:36:15 UTC
Okay, I forked the repo and will come back to you in time.
Comment 5 David Sterba 2016-01-18 17:35:20 UTC
Fixed in 4.4.

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