Bug 146914 - method KCmdLineArgs::usage exit status from 254 to EXIT_SUCCESS
Summary: method KCmdLineArgs::usage exit status from 254 to EXIT_SUCCESS
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
Depends on:
Reported: 2007-06-18 14:31 UTC by stanv
Modified: 2007-12-19 10:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:

Fix above bporblem (596 bytes, patch)
2007-06-18 14:32 UTC, stanv

Note You need to log in before you can comment on or make changes to this bug.
Description stanv 2007-06-18 14:31:07 UTC
Version:            (using KDE KDE 3.5.7)
Installed from:    Compiled From Sources
OS:                Linux

Any application, that uses KCmdLineArgs for parse command line arguments exit with 254 exit status code with --help option.

kmag --help
kde-config --help
kmixctrl --help

echo $?
Comment 1 stanv 2007-06-18 14:32:06 UTC
Created attachment 20884 [details]
Fix above bporblem
Comment 2 David Faure 2007-12-18 14:05:22 UTC
Well, this was obviously done on purpose.

The original developer of this code isn't active anymore, but I think it makes sense in a way: when you do konqueror --help, you didn't really "succeed" in launching a konqueror window, you only got a help message :-)
Is this behavior of --help creating trouble somehow? Can you give more details about why this is a problem?
One counter-argument is of course that `ls --help` returns 0.
Comment 3 Matthew Woehlke 2007-12-18 17:41:50 UTC
Just my $0.02, but if you *asked* for --help, and it was displayed correctly, well... it successfully did what you asked. Whereas giving usage due to wrong arguments is of course different. Ditto with --version.

Obviously KDE is not a GNU project (although I guess one can argue that --help/--version probably came from GNU), but for what it's worth, the GNU coding standards (http://www.gnu.org/prep/standards/standards.html#g_t_002d_002dhelp and also previous entry for --version) require this behavior ("The standard --help option should output brief documentation for how to invoke the program, on standard output, then exit successfully").
Comment 4 David Faure 2007-12-19 10:50:56 UTC
OK, agreed. This is why the first part of the patch is wrong, it should error when we go to usageError(). The second part of the patch is correct. And in fact I see now that it's already been changed in trunk, for KDE-4.0.