Fix `trap` in a few shell scripts

The original `trap` lines in these scripts are incomplete: in case of
any signal, they delete the working directory but let the script run to
completion, which is useless because it will only proceed to complain
about the working directory being removed.  Add `exit` there, with the
original exit value (not rm's).

Since this is mostly just cosmetic, no backpatch.

Discussion: https://postgr.es/m/20220913181002.hzsosy7qkemb7ky7@alvherre.pgsql
pull/104/head
Alvaro Herrera 3 years ago
parent 152c9f7b8f
commit 3d53b9ef1a
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
  1. 2
      src/tools/find_static
  2. 2
      src/tools/make_ctags
  3. 2
      src/tools/pginclude/cpluspluscheck
  4. 6
      src/tools/pginclude/headerscheck
  5. 2
      src/tools/pgtest

@ -2,7 +2,7 @@
# src/tools/find_static
trap "rm -f /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
# This script finds functions that are either never called, or
# should be static.

@ -5,7 +5,7 @@
command -v ctags >/dev/null || \
{ echo "'ctags' program not found" 1>&2; exit 1; }
trap "rm -f /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
rm -f ./tags
IS_EXUBERANT=""

@ -50,7 +50,7 @@ done
# Create temp directory.
tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 0 1 2 3 15
trap "ret=$?; rm -rf $tmp; exit $ret" 0 1 2 3 15
exit_status=0

@ -46,7 +46,7 @@ CPPFLAGS=`echo "$CPPFLAGS" | sed "s|\\\$(PG_SYSROOT)|$PG_SYSROOT|g"`
# Create temp directory.
tmp=`mktemp -d /tmp/$me.XXXXXX`
trap 'rm -rf $tmp' 0 1 2 3 15
trap "ret=$?; rm -rf $tmp; exit $ret" 0 1 2 3 15
exit_status=0
@ -154,9 +154,9 @@ do
EXTRAINCLUDES="$python_includespec" ;;
src/interfaces/ecpg/*)
EXTRAINCLUDES="-I $builddir/src/interfaces/ecpg/include -I $srcdir/src/interfaces/ecpg/include" ;;
src/backend/parser/*)
src/backend/parser/*)
EXTRAINCLUDES="-I $builddir/src/backend/parser/" ;;
src/backend/utils/adt/*)
src/backend/utils/adt/*)
EXTRAINCLUDES="-I $builddir/src/backend/utils/adt/" ;;
*)
EXTRAINCLUDES="" ;;

@ -14,7 +14,7 @@ MAKE="make"
[ ! -d src ] && echo "This must be run from the top of the PostgreSQL source tree" 1>&2 && exit 1
trap "rm -rf /tmp/$$" 0 1 2 3 15
trap "ret=$?; rm -rf /tmp/$$; exit $ret" 0 1 2 3 15
mkdir /tmp/$$
TMP="/tmp/$$"

Loading…
Cancel
Save