Subject: Re: bug#5817: "false" core util

From: Bob Proulx <[email-masked]>
Date: Sat, 3 Apr 2010 15:21:03 -0600

tags 5817 + moreinfo unreproducible
thanks

phoenix wrote:
> I've found a serious error in the program "false": If I pipe some text to it
> (e.g. echo "i lost the game" | false), it does not fail but rather returns a
> success. Any suggestions?

As others noted the 'false' command is a builtin to most shells.
Therefore if you execute the following you are not getting the
coreutils version of false but are instead getting your shell builtin
version of false.  In this case I am running bash and bash detects the
error.

  $ echo foo | false
  -bash: echo: write error: Broken pipe
  $ echo $?
  1
  $ type false
  false is a shell builtin
  $ help false
  false: false
    Return an unsuccessful result.

In order to get the coreutils version you would need to specify a path
to it.  But the shell should still detect this error.

  $ echo foo | /bin/false
  -bash: echo: write error: Broken pipe
  $ echo $?
  1

The main reason for a standalone executable is for legacy
compatibility and also on those occations when a program that isn't a
shell needs to exec a program.

> I need this program very much for completing my thesis on
> Pseudo-Riemannian manifolds.

Nice!  And on April 1st too!

> It would very kind of you if you'd inform me when the error has been fixed.
> (Remark: I am using Ubuntu 9.10.)

I do not presently have an Ubuntu system available to test this upon
but I believe it to be a problem specific to either your shell or to
your environment.  Coreutils false doesn't have this problem.  Neither
does Debian which as you know is the basis for Ubuntu.

Humorous Side Note: It has been remarked that false is actually more
portable than true.  Because if it doesn't exist the shell's exit
status is still failure.

Bob