Subject: bug#13899: closed (Re: bug#13899: Bugs in echo and printf)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 07 Mar 2013 22:30:03 +0000

Your bug report

#13899: Bugs in echo and printf

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13899: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13899
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13899: Bugs in echo and printf
From: Eric Blake <[email-masked]>
To: Sérgio Coutinho <[email-masked]>
Cc: [email-masked]
Date: Thu, 07 Mar 2013 15:29:08 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

tag 13899 notabug
thanks

On 03/07/2013 02:57 PM, Sérgio Coutinho wrote:
> Hello!
> 
> I discovered a few bugs in echo and printf.
> 
> echo --help
> echo --version
> printf --help
> printf --version
> 
> They all don't work...

Thanks for the report.  However, without telling us what you saw vs.
what you were expecting, it's hard to guess what you saw, or why you
think that what you saw is wrong.  Furthermore, I suspect this is
misunderstanding on your part, rather than an actual bug in coreutils.

First, are you sure you were even testing coreutils' binaries, or were
you testing the builtins that ship as part of your shell?  For these two
binaries, you are best off running 'env echo' or 'env printf' if you
want to ensure that you are running the executable that coreutils
installed into your PATH rather than your shell's version.

Second, the behavior we have is intentional:

By default, coreutils' echo produces useful messages, even though this
violates POSIX:

$ env -u POSIXLY_CORRECT echo --help | tail -n1
For complete documentation, run: info coreutils 'echo invocation'
$ env -u POSIXLY_CORRECT echo --version | head -n1
echo (GNU coreutils) 8.17

You can bypass these messages by asking for POSIX compliance, so that
our hands are tied and we output a literal string:

$ env POSIXLY_CORRECT=1 echo --help
--help
$ env POSIXLY_CORRECT=1 echo --version
--version

Meanwhile, for printf, our behavior of useful messages is an extension
permitted by POSIX, so POSIXLY_CORRECT has no impact on operation:

$ env printf --help | tail -n1
For complete documentation, run: info coreutils 'printf invocation'
$ env printf --version | head -n1
printf (GNU coreutils) 8.17

And again, you can bypass these messages with the POSIX-mandated syntax:

$ env printf -- --help
--help
$ env printf -- --version
--version

As such, I'm closing this bug report, although you can feel free to add
further comments or questions.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Subject: Bugs in echo and printf
From: Sérgio Coutinho <[email-masked]>
To: [email-masked]
Date: Thu, 7 Mar 2013 21:57:20 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello!

I discovered a few bugs in echo and printf.

echo --help
echo --version
printf --help
printf --version

They all don't work...

Sergio