On Fri, Sep 19, 2025 at 09:20:57AM -0400, Chet Ramey wrote:
> On 9/19/25 7:26 AM, Andreas Kähäri wrote:
(Adding the text from the original poster, since it was lost. Note that
the message that Chet replies to here is my response to the original
poster, which tries to unpack the issue a bit.)
On Fri, Sep 19, 2025 at 11:40:51AM +0200, pourko--- via Bug reports for
the GNU Bourne Again SHell wrote:
> Wouldn't it be more reasonable to return 0 when invoking
> builtin_name --help
> the way most external commands do?
> (Unless there's actually an error.)
>
>
> > The bug here seems to be that the "--help" long option provokes a
> > behaviour from some built-ins that is not documented.
>
> Such as?
Outputting help text.
>
> > To get the help text, one should use "help builtin_name"
> > (this also works for built-ins like "[" and "echo" that do not recognize
> > "--help"). This is the point of the "help" built-in.
>
> This is true, but the --help option is part of the GNU coding standards.
> (I drew the line at adding --version to every builtin.)
I'm not _seriously_ saying that there is a bug (this is not *my* bug
report, after all), but if there is a bug, then it's the fact that
"--help" isn't documented as a valid option, *or* that some built-ins
are outputting help text without this being a documented behaviour. Or,
as the original poster suggested, the bug may be that (according to the
GNU coding standards), the utilities should exit with a 0 exit status
when "--help" is used.
Personally, I think that exting with a non-zero exit status is correct,
when an undocumented option ("--help") is used, and that the extra
behaviour of outputting help text is unhelpful (since the "help" builtin
does this already).
But what I think is not the point. It would be more interesting to see
what pourko thinks about this.
--
Matti Andreas Kähäri
Uppsala, Sweden
.