Bug 1013556 - [Quota]: The return value of `help' command should be 0
Summary: [Quota]: The return value of `help' command should be 0
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Gluster Storage
Classification: Red Hat Storage
Component: glusterfs
Version: 2.1
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: ---
: ---
Assignee: Anuradha
QA Contact: Saurabh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-09-30 10:37 UTC by Sachidananda Urs
Modified: 2016-09-20 02:00 UTC (History)
11 users (show)

Fixed In Version: glusterfs-3.4.0.35rhs
Doc Type: Bug Fix
Doc Text:
Previously, the help option with Quota did not display appropriate message. Executing a quota command with an invalid option would not have a clear output. Now, with this fix an error message is displayed indicating that the option is invalid while executing the the quota command.
Clone Of:
Environment:
Last Closed: 2013-11-27 15:41:05 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:1769 0 normal SHIPPED_LIVE Red Hat Storage 2.1 enhancement and bug fix update #1 2013-11-27 20:17:39 UTC

Description Sachidananda Urs 2013-09-30 10:37:17 UTC
Description of problem:
The return value of the quota help command, upon successful printing of help text should be 0 not 1

[root@boggs ~]# gluster volume quota pure_gold help >/dev/null 2>&1                                      
[root@boggs ~]# echo $?
1

For example:
[root@boggs ~]# glusterfs --help >/dev/null 2>&1
[root@boggs ~]# echo $?
0

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

How reproducible:
Always.

Actual results:
return value of help command is 1

Expected results:
return value of help command should be 0

Additional info:
Standard Unix utilities return 0 as a convention.

[root@boggs ~]# ls --help >/dev/null 
[root@boggs ~]# echo $?
0
[root@boggs ~]# dd --help > /dev/null 
[root@boggs ~]# echo $?
0
[root@boggs ~]#

Comment 1 Sachidananda Urs 2013-09-30 10:41:07 UTC
If help is displayed as part of a syntax mistake, 1 is a valid return value. But not for `help' command in itself.

[root@boggs ~]# gluster volume quota pure_gold default-soft-limit 50 a                                    
Usage: volume quota <VOLNAME> {enable|disable|list [<path> ...]|remove <path>| default-soft-limit <percent>} |
volume quota <VOLNAME> {limit-usage <path> <size> [<percent>]} |
volume quota <VOLNAME> {alert-time|soft-timeout|hard-timeout} {<time>}
[root@boggs ~]# echo $?
1

Comment 3 Kaushal 2013-10-04 04:45:54 UTC
Quota does not actually have any 'help' subcommand. The usage message displayed is because of parse failure, because 'help' is not a known option. This is similar to what happens when you give unknown options to other commands as well.
For eg., in volume profile,
 # gluster volume profile test help
 Usage: volume profile <VOLNAME> {start|stop|info [nfs]}
 # echo $?
 1

Sac, do you still feel we need to correct this? If so then it must be done for all commands, not just quota.

Comment 4 Sachidananda Urs 2013-10-04 06:52:54 UTC
Doing it to all commands is useful. However, can't we print something like:

quota help: subcmd not found
Usage:

It is quite misleading.

Comment 8 Anuradha 2013-10-08 07:15:12 UTC
Patch posted for review on branch rhs-2.1 :
https://code.engineering.redhat.com/gerrit/#/c/13767/2

Patch posted for review on branch rhs-2.1-u1 :
https://code.engineering.redhat.com/gerrit/#/c/13771/

Comment 11 Pavithra 2013-10-29 10:48:24 UTC
hi Anuradha,

Can you please review the edited doc text for this bug? Once you sign off, this text will be added to the errata.

Comment 12 Anuradha 2013-10-30 07:07:10 UTC
Hi Pavithra,

The doc text has all the required info. It can be added to the errata.

Comment 14 errata-xmlrpc 2013-11-27 15:41:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-1769.html


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