mbox series

[RFC,0/3] btrfs-progs: make quiet to overrule verbose

Message ID 20191024062825.13097-1-anand.jain@oracle.com (mailing list archive)
Headers show
Series btrfs-progs: make quiet to overrule verbose | expand

Message

Anand Jain Oct. 24, 2019, 6:28 a.m. UTC
When both the options (--quiet and --verbose) in btrfs send and receive
is specified, we need at least one of it to overrule the other, irrespective
of the chronological order of options.

This patch-set makes quiet overrule verbose.

I don't think this shall break any script as such, because these two options are
of kind of mutually exclusive. But just in case if I am missing something? So
marked it as RFC.

And again patch 3/3 makes quiet option really quiet in receive and removes the
output
 At snapshot <>
I don't expect scripts to specify quiet option and expect some logs.

Anand Jain (3):
  btrfs-progs: send: let option quiet overrule verbose
  btrfs-progs: receive: let option quiet overrule verbose
  btrfs-progs: receive: make quiet really quiet

 cmds/receive.c | 9 +++++++--
 cmds/send.c    | 6 +++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

Comments

David Sterba Oct. 24, 2019, 3:41 p.m. UTC | #1
On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
> When both the options (--quiet and --verbose) in btrfs send and receive
> is specified, we need at least one of it to overrule the other, irrespective
> of the chronological order of options.

I think the common behaviour is to respect the order of appearance on
the commandline. So 'command -vvv -q' will be the same as 'command -q',
while 'command -q -vvv' will be 'command -vvv'.

Eg. ssh behaves like that, OTOH rsync does not and -q beats -vvv. I
don't know about other commands that accept multiple -v and -q to get
more samples. The usage pattern where order on command line matters is
following the idea where there's a long line and adding -vvv to the end
will make it verbose.
Anand Jain Oct. 24, 2019, 11:51 p.m. UTC | #2
On 24/10/19 11:41 PM, David Sterba wrote:
> On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
>> When both the options (--quiet and --verbose) in btrfs send and receive
>> is specified, we need at least one of it to overrule the other, irrespective
>> of the chronological order of options.
> 
> I think the common behaviour is to respect the order of appearance on
> the commandline.

   I am fine with this. Will fix it as this.

   (IMO generally command -q is used in scripts so it makes sense to keep
   it absolutely quiet when used. Where as -v is used for
   understanding.).

> So 'command -vvv -q' will be the same as 'command -q',

> while 'command -q -vvv' will be 'command -vvv'.

  We need to fix this. As of now command -q -vvv is command -vv.

Thanks, Anand

> Eg. ssh behaves like that, OTOH rsync does not and -q beats -vvv. I
> don't know about other commands that accept multiple -v and -q to get
> more samples. The usage pattern where order on command line matters is
> following the idea where there's a long line and adding -vvv to the end
> will make it verbose.
>
Anand Jain Oct. 25, 2019, 1:56 a.m. UTC | #3
On 25/10/19 7:51 AM, Anand Jain wrote:
> 
> 
> On 24/10/19 11:41 PM, David Sterba wrote:
>> On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
>>> When both the options (--quiet and --verbose) in btrfs send and receive
>>> is specified, we need at least one of it to overrule the other, 
>>> irrespective
>>> of the chronological order of options.
>>
>> I think the common behaviour is to respect the order of appearance on
>> the commandline.
> 
>    I am fine with this. Will fix it as this.

  Question: command -v -q -v should be equal to command -v, right?

Thanks, Anand


>    (IMO generally command -q is used in scripts so it makes sense to keep
>    it absolutely quiet when used. Where as -v is used for
>    understanding.).
> 
>> So 'command -vvv -q' will be the same as 'command -q',
> 
>> while 'command -q -vvv' will be 'command -vvv'.
> 
>   We need to fix this. As of now command -q -vvv is command -vv.
> 
> Thanks, Anand
> 
>> Eg. ssh behaves like that, OTOH rsync does not and -q beats -vvv. I
>> don't know about other commands that accept multiple -v and -q to get
>> more samples. The usage pattern where order on command line matters is
>> following the idea where there's a long line and adding -vvv to the end
>> will make it verbose.
>>
> 
>
David Sterba Oct. 25, 2019, 4:35 p.m. UTC | #4
On Fri, Oct 25, 2019 at 09:56:14AM +0800, Anand Jain wrote:
> On 25/10/19 7:51 AM, Anand Jain wrote:
> > 
> > 
> > On 24/10/19 11:41 PM, David Sterba wrote:
> >> On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
> >>> When both the options (--quiet and --verbose) in btrfs send and receive
> >>> is specified, we need at least one of it to overrule the other, 
> >>> irrespective
> >>> of the chronological order of options.
> >>
> >> I think the common behaviour is to respect the order of appearance on
> >> the commandline.
> > 
> >    I am fine with this. Will fix it as this.
> 
>   Question: command -v -q -v should be equal to command -v, right?

No, that would be equivalent to the default level:

verbose starts with 1			()
verbose++				(-v)
verbose = 0				(-q)
verbose++ is now 1, which is not -v	()
Anand Jain Oct. 26, 2019, 1:01 a.m. UTC | #5
On 26/10/19 12:35 AM, David Sterba wrote:
> On Fri, Oct 25, 2019 at 09:56:14AM +0800, Anand Jain wrote:
>> On 25/10/19 7:51 AM, Anand Jain wrote:
>>>
>>>
>>> On 24/10/19 11:41 PM, David Sterba wrote:
>>>> On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
>>>>> When both the options (--quiet and --verbose) in btrfs send and receive
>>>>> is specified, we need at least one of it to overrule the other,
>>>>> irrespective
>>>>> of the chronological order of options.
>>>>
>>>> I think the common behaviour is to respect the order of appearance on
>>>> the commandline.
>>>
>>>     I am fine with this. Will fix it as this.
>>
>>    Question: command -v -q -v should be equal to command -v, right?
> 
> No, that would be equivalent to the default level:
> 
> verbose starts with 1			()
> verbose++				(-v)
> verbose = 0				(-q)
> verbose++ is now 1, which is not -v	()
> 

Oh I was thinking its a bug, and no need to carry forward to the global
verbose. Will make it look like this.
Anand Jain Oct. 29, 2019, 7:42 p.m. UTC | #6
On 26/10/19 9:01 AM, Anand Jain wrote:
> On 26/10/19 12:35 AM, David Sterba wrote:
>> On Fri, Oct 25, 2019 at 09:56:14AM +0800, Anand Jain wrote:
>>> On 25/10/19 7:51 AM, Anand Jain wrote:
>>>>
>>>>
>>>> On 24/10/19 11:41 PM, David Sterba wrote:
>>>>> On Thu, Oct 24, 2019 at 02:28:22PM +0800, Anand Jain wrote:
>>>>>> When both the options (--quiet and --verbose) in btrfs send and 
>>>>>> receive
>>>>>> is specified, we need at least one of it to overrule the other,
>>>>>> irrespective
>>>>>> of the chronological order of options.
>>>>>
>>>>> I think the common behaviour is to respect the order of appearance on
>>>>> the commandline.
>>>>
>>>>     I am fine with this. Will fix it as this.
>>>
>>>    Question: command -v -q -v should be equal to command -v, right?
>>
>> No, that would be equivalent to the default level:
>>
>> verbose starts with 1            ()
>> verbose++                (-v)
>> verbose = 0                (-q)
>> verbose++ is now 1, which is not -v    ()
>>
> 
> Oh I was thinking its a bug, and no need to carry forward to the global
> verbose. Will make it look like this.
> 

What do you think should be the final %verbose value when both
local and global verbose and or quiet options are specified?

For example:
  btrfs -v -q sub-command -v
  btrfs -q sub-command -v
  btrfs -vv sub-command -q
  etc..

Thanks, Anand
David Sterba Nov. 1, 2019, 3:18 p.m. UTC | #7
On Wed, Oct 30, 2019 at 03:42:56AM +0800, Anand Jain wrote:
> >>>    Question: command -v -q -v should be equal to command -v, right?
> >>
> >> No, that would be equivalent to the default level:
> >>
> >> verbose starts with 1            ()
> >> verbose++                (-v)
> >> verbose = 0                (-q)
> >> verbose++ is now 1, which is not -v    ()
> >>
> > 
> > Oh I was thinking its a bug, and no need to carry forward to the global
> > verbose. Will make it look like this.
> 
> What do you think should be the final %verbose value when both
> local and global verbose and or quiet options are specified?
> 
> For example:
>   btrfs -v -q sub-command -v
>   btrfs -q sub-command -v
>   btrfs -vv sub-command -q
>   etc..

Ah that's the conflicting part. I'd say treat all -v and -q equal, so
modify the bconf.verbose variable, and it's straightforward to document.
Some time in the future we should also issue a warning for 'sub-command
-v'.

The order makes it unintuitive so

  btrfs -q command -v

is going to be the default verbosity. We can't ignore the sub-command
part, and making it conditionally work in case there's no global
verbosity setting is kind of complicating it.

So let's take the simple approach, maybe we'll have second thought on
that before release.
Anand Jain Nov. 4, 2019, 6:26 a.m. UTC | #8
On 11/1/19 11:18 PM, David Sterba wrote:
> On Wed, Oct 30, 2019 at 03:42:56AM +0800, Anand Jain wrote:
>>>>>     Question: command -v -q -v should be equal to command -v, right?
>>>>
>>>> No, that would be equivalent to the default level:
>>>>
>>>> verbose starts with 1            ()
>>>> verbose++                (-v)
>>>> verbose = 0                (-q)
>>>> verbose++ is now 1, which is not -v    ()
>>>>
>>>
>>> Oh I was thinking its a bug, and no need to carry forward to the global
>>> verbose. Will make it look like this.
>>
>> What do you think should be the final %verbose value when both
>> local and global verbose and or quiet options are specified?
>>
>> For example:
>>    btrfs -v -q sub-command -v
>>    btrfs -q sub-command -v
>>    btrfs -vv sub-command -q
>>    etc..
> 
> Ah that's the conflicting part.

> I'd say treat all -v and -q equal,

  Umm I don't understand what is treating equal here.
  The sub-command already treats differently under sub-command options.
  As shown below.

       case 'v':
                 bconf.verbose++;
                 break;
       case 'q':
                 bconf.verbose = 0;
		break;


> so
> modify the bconf.verbose variable, and it's straightforward to document.
> Some time in the future we should also issue a warning for 'sub-command
> -v'.

  I am guessing you mean:- Warning option is deprecated ?

> The order makes it unintuitive so
> 
>    btrfs -q command -v
> 
> is going to be the default verbosity.

  default verbosity is 0? 1 ?
  As of now in send/receive default verbosity is 1. And rest
  of the sub-commands its 0.

  And as the -v is last to appear the command will be
  equivalent to 'btrfs sub-command -q -v' which is verbosity level 1.
  I hope this is reasonable.

> We can't ignore the sub-command
> part, and making it conditionally work in case there's no global
> verbosity setting is kind of complicating it.

  Umm. As of now in v1.1, the sub-command continues to operate on the
  global bconf.verbose values, which works very well. Please see v1.1
  in the ML.

> So let's take the simple approach, maybe we'll have second thought on
> that before release.
> 

  Sure. To simplify the discussion, in v1.1 cover-letter I have included
  verbosity implementation code sample, hope this helps.

verbosity code sample as in v1.1

Thanks, Anand