[LU-8621] Parser_execarg() prints help to stderr, usage to stdout Created: 16/Sep/16  Updated: 20/Dec/22  Resolved: 11/Jul/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.16.0

Type: Bug Priority: Minor
Reporter: John Hammond Assignee: Aleksei Alyaev (Inactive)
Resolution: Fixed Votes: 0
Labels: easy, utils

Issue Links:
Related
is related to LU-16392 Bash completion regressions, lctl and... Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

When running lfs CMD --help or lctl CMD --help the help message is printed to stderr. By convention stdout should be used instead.

When using lfs or lctl, if an unrecognized command is passed to Parser_execarg() we get a 100+ line usage message printed to stdout.

# lctl barf
Try interactive use without arguments or use one of:
"===== metacommands ======="
"--device"
"--ignore_errors"
"ignore_errors"
"======== control ========="
"help"
"lustre_build_version"
"exit"
"quit"
...
"llog_print"
"llog_check"
"llog_cancel"
"llog_remove"
"add_interface"
"del_interface"
"add_route"
"del_route"
"set_route"
as argument.
  1. We shouldn't spam the terminal with so many lines of output for an unrecognized command.
  2. We need to print the command that was passed.
    # git barf
    git: 'barf' is not a git command. See 'git --help'.
    
    Did you mean this?
    	branch
    


 Comments   
Comment by Gerrit Updater [ 28/Apr/22 ]

"Andreas Dilger <adilger@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/47162
Subject: LU-8621 utils: cmd help to stdout or short cmd error
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: ab80394f9bb2a49c61f14499843c974a1db7aece

Comment by Gerrit Updater [ 11/Jul/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/47162/
Subject: LU-8621 utils: cmd help to stdout or short cmd error
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: bc69a8d058f5bcdb75e062df57a6ccd23243d1e0

Comment by Peter Jones [ 11/Jul/22 ]

Landed for 2.16

Comment by Alex Zhuravlev [ 12/Jul/22 ]

somehow this patch breaks sanity-quota/8:

Throughput 4.31965 MB/sec 3 clients 3 procs max_latency=152.458 ms
sanity-quota test_8: @@@@@@ FAIL: test_8 failed with 1
Trace dump:
= ./../tests/test-framework.sh:6522:error()
= ./../tests/test-framework.sh:6858:run_one()
= ./../tests/test-framework.sh:6905:run_one_logged()
= ./../tests/test-framework.sh:6730:run_test()
= sanity-quota.sh:2299:main()
Dumping lctl log to /tmp/ltest-logs/sanity-quota.test_8.*.1657617064.log
Dumping logs only on local client.
Delete files...
Wait for unlink objects finished...
Waiting for MDT destroys to complete
test_8 returned 1
FAIL 8 (182s)

bisection result:

COMMIT		TESTED	PASSED	FAILED		COMMIT DESCRIPTION
210803a247	1	0	1	BAD	LU-15653 client: able to cleanup devices manually
a21ce928aa	1	0	1	BAD	LU-15894 ofd: revert range locking in ofd
b2dfb4457f	1	0	1	BAD	LU-15759 libcfs: debugfs file_operation should have an owner
98ba508190	1	0	1	BAD	LU-15779 ofd: don't hold read lock over bulk
0396310692	1	0	1	BAD	LU-15727 lod: honor append_pool with default composite layouts
71d63602c5	1	0	1	BAD	LU-15922 sec: new connect flag for name encryption
4a2498d22f	1	0	1	BAD	LU-15952 doc: improvement on lfs-project doc
9bf968db56	1	0	1	BAD	LU-15942 utils: ofd_access_log_reader exit status
e3a4dc406f	1	0	1	BAD	LU-15931 tests: Escape * in log()
bc69a8d058	1	0	1	BAD	LU-8621 utils: cmd help to stdout or short cmd error
6ab060e58e	4	4	0		LU-14555 lnet: asym route inconsistency warning
6bceb0030d	4	4	0		LU-13335 ldiskfs: add projid to debug logs
aa22a6826e	4	4	0		LU-15481 llog: Add LLOG_SKIP_PLAIN to skip llog plain
Generated at Sat Feb 10 02:19:09 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.