[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: --help and --version should exit with nonzero status on write failur
From: |
Alexandre Duret-Lutz |
Subject: |
Re: --help and --version should exit with nonzero status on write failures |
Date: |
Wed, 02 Feb 2005 21:58:25 +0100 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) |
>>> "Paul" == Paul Eggert <address@hidden> writes:
Paul> I noticed that Automake-related commands exit with status zero when
Paul> giving help or version output, even if there is a write failure.
Paul> That isn't right: they should exit with status zero only if they
Paul> successfully output the help or version information requested.
Paul> Here is a patch for the shell commands affected; these are higher
Paul> priority for me, as they are used by other programs like Automake.
Thanks a lot! I've installed this on HEAD and branch-1-9 as follows.
(Aren't you an emacs user? Why didn't the time-stamp hook work?)
Paul> I suspect that non-shell programs also need fixing, though.
Seems OK. Automake's Perl scripts use General::END, defined as follows:
# END
# ---
# Exit nonzero whenever closing STDOUT fails.
sub END
{
# This is required if the code might send any output to stdout
# E.g., even --version or --help. So it's best to do it unconditionally.
if (! close STDOUT)
{
print STDERR "$me: closing standard output: $!\n";
$? = 74; # EX_IOERR
return;
}
}
2005-02-02 Paul Eggert <address@hidden>
* lib/depcomp: Exit with nonzero status if a write failure occurs
with --help or --version option.
* lib/elisp-comp: Likewise.
* lib/gnupload: Likewise.
* lib/install-sh: Likewise.
* lib/missing: Likewise.
* lib/mkinstalldirs: Likewise.
Index: lib/depcomp
===================================================================
RCS file: /cvs/automake/automake/lib/depcomp,v
retrieving revision 1.51
diff -u -r1.51 depcomp
--- lib/depcomp 31 May 2004 21:44:57 -0000 1.51
+++ lib/depcomp 2 Feb 2005 20:32:45 -0000
@@ -1,9 +1,9 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2004-05-31.23
+scriptversion=2005-02-02.21
-# Copyright (C) 1999, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -50,11 +50,11 @@
Report bugs to <address@hidden>.
EOF
- exit 0
+ exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
- exit 0
+ exit $?
;;
esac
Index: lib/elisp-comp
===================================================================
RCS file: /cvs/automake/automake/lib/elisp-comp,v
retrieving revision 1.11
diff -u -r1.11 elisp-comp
--- lib/elisp-comp 10 Sep 2004 18:47:08 -0000 1.11
+++ lib/elisp-comp 2 Feb 2005 20:32:45 -0000
@@ -1,7 +1,7 @@
#!/bin/sh
-# Copyright (C) 1995, 2000, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 1995, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-scriptversion=2004-09-10.20
+scriptversion=2005-02-02.21
# Franc,ois Pinard <address@hidden>, 1995.
#
@@ -47,11 +47,11 @@
Report bugs to <address@hidden>.
EOF
- exit 0
+ exit $?
;;
-v | --v*)
echo "elisp-comp $scriptversion"
- exit 0
+ exit $?
;;
esac
Index: lib/gnupload
===================================================================
RCS file: /cvs/automake/automake/lib/gnupload,v
retrieving revision 1.4
diff -u -r1.4 gnupload
--- lib/gnupload 29 Feb 2004 22:28:39 -0000 1.4
+++ lib/gnupload 2 Feb 2005 20:32:45 -0000
@@ -1,9 +1,9 @@
#!/bin/sh
# Sign files and upload them.
-scriptversion=2004-02-29.23
+scriptversion=2005-02-02.21
-# Copyright (C) 2004 Free Software Foundation
+# Copyright (C) 2004, 2005 Free Software Foundation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -55,7 +55,7 @@
case $1 in
--help)
echo "$usage"
- exit 0
+ exit $?
;;
--to)
if test -z "$2"; then
@@ -77,7 +77,7 @@
;;
--version)
echo "gnupload $scriptversion"
- exit 0
+ exit $?
;;
-*)
echo "$0: Unknown option \`$1', try \`$0 --help'" 1>&2
Index: lib/install-sh
===================================================================
RCS file: /cvs/automake/automake/lib/install-sh,v
retrieving revision 1.22
diff -u -r1.22 install-sh
--- lib/install-sh 17 Dec 2004 23:25:09 -0000 1.22
+++ lib/install-sh 2 Feb 2005 20:32:45 -0000
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2004-12-17.09
+scriptversion=2005-02-02.21
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -109,7 +109,7 @@
shift
continue;;
- --help) echo "$usage"; exit 0;;
+ --help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
@@ -134,7 +134,7 @@
shift
continue;;
- --version) echo "$0 $scriptversion"; exit 0;;
+ --version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
Index: lib/missing
===================================================================
RCS file: /cvs/automake/automake/lib/missing,v
retrieving revision 1.25
diff -u -r1.25 missing
--- lib/missing 7 Sep 2004 06:25:31 -0000 1.25
+++ lib/missing 2 Feb 2005 20:32:45 -0000
@@ -1,9 +1,9 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2004-09-07.08
+scriptversion=2005-02-02.21
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <address@hidden>, 1996.
@@ -87,12 +87,12 @@
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <address@hidden>."
- exit 0
+ exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
- exit 0
+ exit $?
;;
-*)
Index: lib/mkinstalldirs
===================================================================
RCS file: /cvs/automake/automake/lib/mkinstalldirs,v
retrieving revision 1.16
diff -u -r1.16 mkinstalldirs
--- lib/mkinstalldirs 15 Feb 2004 21:14:23 -0000 1.16
+++ lib/mkinstalldirs 2 Feb 2005 20:32:45 -0000
@@ -1,7 +1,7 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
-scriptversion=2004-02-15.20
+scriptversion=2005-02-02.21
# Original author: Noah Friedman <address@hidden>
# Created: 1993-05-16
@@ -27,7 +27,7 @@
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
- exit 0
+ exit $?
;;
-m) # -m PERM arg
shift
@@ -37,7 +37,7 @@
;;
--version)
echo "$0 $scriptversion"
- exit 0
+ exit $?
;;
--) # stop option processing
shift
--
Alexandre Duret-Lutz