[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: false --help vs. false --version
From: |
Jim Meyering |
Subject: |
Re: false --help vs. false --version |
Date: |
Wed, 02 Apr 2003 20:21:45 +0200 |
address@hidden (Paul Jarc) wrote:
> false --help exits 0. false --version exits 1. I think false --help
> should be changed, but certainly one of them should be.
Thank you for pointing that out!
I've fixed it for the upcoming coreutils-5.0.
* src/Makefile.am (false.c): Change all occurrences of
`(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
unsuccessfully also with --help. Reported by Paul Jarc,
* tests/misc/false: New test for the above.
Index: src/Makefile.am
===================================================================
RCS file: /fetish/cu/src/Makefile.am,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -p -u -r1.18 -r1.19
--- src/Makefile.am 19 Mar 2003 23:17:12 -0000 1.18
+++ src/Makefile.am 2 Apr 2003 07:21:40 -0000 1.19
@@ -178,7 +178,7 @@ false.c: true.c
sed \
-e s/true/false/g \
-e s/success/failure/g \
- -e 's/^ exit (EXIT_SUCCESS/ exit (EXIT_FAILURE/g' \
+ -e 's/(EXIT_SUCCESS)/(EXIT_FAILURE)/g' \
$(srcdir)/true.c > address@hidden
chmod a-w address@hidden
mv address@hidden $@
Here's what motivated me to change `false --version' to exit nonzero.
From: Felix Lee <address@hidden>
Subject: sh-utils 1.16: "false" isn't always false
To: address@hidden
Date: Wed, 03 Mar 1999 15:16:11 -0800
The command
false --version
exits with zero status. I think 'false' should always exit
with non-zero status.
Why this matters:
tries="awk gawk nawk mawk"
for try in false $tries; do
if ($try --version) >/dev/null 2>&1; then
echo "my favorite awk is $try"
fi
done
(note, the bash built-in 'false' doesn't do anything with
'--version' and always exits non-zero.)
-----------------
I see (in CVS log) that I made this change,
date: 2002/07/20 15:18:20; author: meyering; state: Exp; lines: +1 -1
(false.c): Convert only the final EXIT_SUCCESS
into EXIT_FAILURE. Otherwise, false --help and false --version
would fail.
but, surprisingly, there's no corresponding ChangeLog entry.
I've just added it.
-----------------
In any case, I've also added a test case, so this should
not happen again.
- false --help vs. false --version, Paul Jarc, 2003/04/02
- Re: false --help vs. false --version, Bob Proulx, 2003/04/02
- Re: false --help vs. false --version,
Jim Meyering <=
- Re: false --help vs. false --version, Paul Eggert, 2003/04/02
- Re: false --help vs. false --version, Jim Meyering, 2003/04/03
- Re: false --help vs. false --version, Paul Jarc, 2003/04/03
- Re: false --help vs. false --version, Jim Meyering, 2003/04/03
- Re: false --help vs. false --version, Paul Jarc, 2003/04/03
- Re: false --help vs. false --version, Jim Meyering, 2003/04/03