emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#54516: closed (Sed help message error)


From: GNU bug Tracking System
Subject: bug#54516: closed (Sed help message error)
Date: Tue, 22 Mar 2022 03:54:01 +0000

Your message dated Mon, 21 Mar 2022 21:53:32 -0600
with message-id <20220321214440294606677@bob.proulx.com>
and subject line Re: bug#54516: Sed help message error
has caused the debbugs.gnu.org bug report #54516,
regarding Sed help message error
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
54516: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=54516
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: Sed help message error Date: Mon, 21 Mar 2022 22:47:17 -0400
Hello there,

Here's a random bug I just found:
sed|sed 's/sed/bob/g;'
This should replace the word sed in the help but it doesn't since the help output is actually in the error pipe. With this version of the command it'll work however, which proves this:
sed 2>&1|sed 's/sed/bob/g;'

So, is this a feature or a bug considering "sed --help" outputs in the normal output pipe?

Thanks

--- End Message ---
--- Begin Message --- Subject: Re: bug#54516: Sed help message error Date: Mon, 21 Mar 2022 21:53:32 -0600
Rolf Johns wrote:
> Here's a random bug I just found:
> sed|sed 's/sed/bob/g;'
> This should replace the word sed in the help but it doesn't since the help
> output is actually in the error pipe. With this version of the command
> it'll work however, which proves this:
> sed 2>&1|sed 's/sed/bob/g;'
>
> So, is this a feature or a bug considering "sed --help" outputs in the
> normal output pipe?

Running sed without any options is a usage error.  Since sed requires
at least a script as an argument parameter.  Since the sed script is
missing sed is emitting an error message to standard error and exiting
with an error status code.  (I'll note that awk does the same thing.)

    $ sed 2>/dev/null ; echo $?
    1

The sed --help is not an error.  In that case sed is being asked for
the help information.  And therefore it is being emitted to standard
output instead of standard error.  The exit code is success.

    $ sed --help >/dev/null ; echo $?
    0

All seems to be operating as desired.  Hope this explanation helps.

It's arguable that upon an error that *less* information should be
emitted to stderr.  Perhaps just the Usage line, a pointer to the
--help output, and nothing more.  Then the usage error would be less
likely to be confused with a help output message.  Such as for example
the way tar behaves.

    $ tar
    tar: You must specify one of the '-Acdtrux', '--delete' or '--test-label' 
options
    Try 'tar --help' or 'tar --usage' for more information.
    $ echo $?
    2

Bob


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]