GNU bug report logs - #13899
Bugs in echo and printf

Previous Next

Package: coreutils;

Reported by: Sérgio Coutinho <sealanco <at> gmail.com>

Date: Thu, 7 Mar 2013 22:01:01 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Sérgio Coutinho <sealanco <at> gmail.com>
Subject: bug#13899: closed (Re: bug#13899: Bugs in echo and printf)
Date: Thu, 07 Mar 2013 22:30:03 +0000
[Message part 1 (text/plain, inline)]
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 13899 <at> debbugs.gnu.org.

-- 
13899: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13899
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Eric Blake <eblake <at> redhat.com>
To: Sérgio Coutinho <sealanco <at> gmail.com>
Cc: 13899-done <at> debbugs.gnu.org
Subject: Re: bug#13899: Bugs in echo and printf
Date: Thu, 07 Mar 2013 15:29:08 -0700
[Message part 3 (text/plain, inline)]
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

[signature.asc (application/pgp-signature, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Sérgio Coutinho <sealanco <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Bugs in echo and printf
Date: Thu, 7 Mar 2013 21:57:20 +0000
Hello!

I discovered a few bugs in echo and printf.

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

They all don't work...

Sergio



This bug report was last modified 12 years and 135 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.