Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS



On Tue, 5 Aug 2008 19:25:58 -0400
"Rocky Bernstein" <rocky.bernstein@xxxxxxxxx> wrote:
> I didn't have a problem writing a program that when run gives exit
> code 0 if this bug is fixed and exit code 10 if not.
> 
> I tried from checked out sources from a couple days ago when there was
> a bug versus currently patched sources. It probably shouldn't be too
> hard to work this into the testing system.

I'll put it in as is.  I think I may have confused myself over the fact
that I head the shell in two states: before fixing the first bug, and after
fixing the second bug, and this condition didn't turn up.  It's worth
testing for.

The previous test depends on DEBUG_BEFORE_CMD not being set.

Index: Test/C03traps.ztst
===================================================================
RCS file: /cvsroot/zsh/zsh/Test/C03traps.ztst,v
retrieving revision 1.12
diff -u -r1.12 C03traps.ztst
--- Test/C03traps.ztst	5 Aug 2008 08:41:24 -0000	1.12
+++ Test/C03traps.ztst	6 Aug 2008 08:48:04 -0000
@@ -350,6 +350,7 @@
 >trap
 >Working 0
 
+  unsetopt DEBUG_BEFORE_CMD
   debug-trap-bug1() {
     setopt localtraps
     print "print bug file here" >bug-file
@@ -388,6 +389,19 @@
 >bug file here
 >EXIT hit
 
+  cat >zsh-trapreturn-bug2 <<-'HERE'
+	cmd='./fdasfsdafd'
+	[[ -x $cmd ]] && rm $cmd
+	set -o DEBUG_BEFORE_CMD
+	trap '[[ $? -ne 0 ]] && exit 0' DEBUG
+	$cmd  # invalid command
+	# Failure
+	exit 10
+	HERE
+  $ZTST_testdir/../Src/zsh -f ./zsh-trapreturn-bug2
+0: trapreturn handling bug is properly fixed
+?./zsh-trapreturn-bug2:5: no such file or directory: ./fdasfsdafd
+
 %clean
 
   rm -f TRAPEXIT

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



Messages sorted by: Reverse Date, Date, Thread, Author