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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13899 in the body.
You can then email your comments to 13899 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#13899; Package coreutils. (Thu, 07 Mar 2013 22:01:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Sérgio Coutinho <sealanco <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Thu, 07 Mar 2013 22:01:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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




Information forwarded to bug-coreutils <at> gnu.org:
bug#13899; Package coreutils. (Thu, 07 Mar 2013 22:29:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ruediger Meier <sweet_f_a <at> gmx.de>
To: bug-coreutils <at> gnu.org
Subject: Re: bug#13899: Bugs in echo and printf
Date: Thu, 7 Mar 2013 23:27:20 +0100
On Thursday 07 March 2013, 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...
>
> Sergio

Probably you are using the shell builtins. Have you tried with full path
/usr/bin/echo --version
/usr/bin/printf --version

cu,
Rudi




Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Thu, 07 Mar 2013 22:30:03 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Thu, 07 Mar 2013 22:30:03 GMT) Full text and rfc822 format available.

Notification sent to Sérgio Coutinho <sealanco <at> gmail.com>:
bug acknowledged by developer. (Thu, 07 Mar 2013 22:30:03 GMT) Full text and rfc822 format available.

Message #15 received at 13899-done <at> debbugs.gnu.org (full text, mbox):

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 1 (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)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 05 Apr 2013 11:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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