Andrew Dunstan wrote:
>
>
> Peter Eisentraut wrote:
>
>>
>> I seem to recall that there is a bug in the FreeBSD shell with line
>> breaks in traps. Try changing the above to
>>
>> trap 'st=$?; echo status = $st; exit $st' 0
>>
>>
>
>
> Thankyou Peter! I'd never have guessed something so obscure!
>
> I have confirmed that this is the problem, and ascertained that the
> Cygwin shell exhibits the same behaviour.
>
> I will submit a patch for pg_regress.sh shortly (after a little
> testing using buildfarm).
>
>
Attached patch has been tested on Cygwin and found to work as expected
when initdb fails during make check - I don't have access to a FreeBSD
machine to do a test buildfarm run.
cheers
andrew
Index: src/test/regress/pg_regress.sh
===================================================================
RCS file: /home/cvsmirror/pgsql/src/test/regress/pg_regress.sh,v
retrieving revision 1.50
diff -c -r1.50 pg_regress.sh
*** src/test/regress/pg_regress.sh 17 Nov 2004 18:06:04 -0000 1.50
--- src/test/regress/pg_regress.sh 11 Dec 2004 21:27:40 -0000
***************
*** 238,255 ****
# with the result of the last shell command before the `exit'. Hence
# we have to write `(exit x); exit' below this point.
! trap '
! savestatus=$?
if [ -n "$postmaster_pid" ]; then
kill -2 "$postmaster_pid"
wait "$postmaster_pid"
unset postmaster_pid
fi
rm -f "$TMPFILE" && exit $savestatus
! ' 0
! trap '
! savestatus=$?
echo; echo "caught signal"
if [ -n "$postmaster_pid" ]; then
echo "signalling fast shutdown to postmaster with pid $postmaster_pid"
--- 238,257 ----
# with the result of the last shell command before the `exit'. Hence
# we have to write `(exit x); exit' below this point.
! exit_trap(){
! savestatus=$1
if [ -n "$postmaster_pid" ]; then
kill -2 "$postmaster_pid"
wait "$postmaster_pid"
unset postmaster_pid
fi
rm -f "$TMPFILE" && exit $savestatus
! }
! trap 'exit_trap $?' 0
!
! sig_trap() {
! savestatus=$1
echo; echo "caught signal"
if [ -n "$postmaster_pid" ]; then
echo "signalling fast shutdown to postmaster with pid $postmaster_pid"
***************
*** 258,264 ****
unset postmaster_pid
fi
(exit $savestatus); exit
! ' 1 2 13 15
--- 260,268 ----
unset postmaster_pid
fi
(exit $savestatus); exit
! }
!
! trap 'sig_trap $?' 1 2 13 15