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
- X-seq: zsh-workers 25398
- From: "Rocky Bernstein" <rocky.bernstein@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS
- Date: Tue, 5 Aug 2008 19:25:58 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=oh4OHJn9lEmLrtPklmSaS9+yeRbUj3HcwMrKGS/eaUg=; b=si9/4LHzMqDo33p788tsSputzvK/wDRXyc4juMKsUu3oBk4PBMd8W7ADh/+doNCrOA /nIHqKeo720urz3hTFkAPOQLs9sDg3NsgGizrLXQjq31Vo3Qx89DWkp0dbcfGGLwjB+7 LLNDw+iYNBMFmELHlURZwg8nsxeTj7js5b5Gk=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=C0HEb0cJi5I4BuVJwrYPG/GUIWvOEoeZ6ikaZ9BXRBqz9oH6c5Dyopk7vyMM0VZHKt I47wljQYfQeDPaCTPs4w8tY4J1NZ+0n0InLXIcjgja8ncZEf6brEpCXHM/omqdk5X0jQ /ZoTus1uIhCWKCsyfDn7tIm77xF6jN5Ti5HQw=
- In-reply-to: <20080805093326.2e2915ec@news01>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <6cd6de210808040308k529da37dh40b8dd1799086420@xxxxxxxxxxxxxx> <20080804184957.421f87c9@news01> <20080805093326.2e2915ec@news01>
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.
#!/usr/local/bin/zsh -f
cmd='./fdasfsdafd'
[[ -x $cmd ]] && rm $cmd
set -o DEBUG_BEFORE_CMD
trap '[[ $? -ne 0 ]] && exit 0' DEBUG
$cmd # invalid command
# Failure
exit 10
# Put the above in a file, call it and test the exit code.
On Tue, Aug 5, 2008 at 4:33 AM, Peter Stephenson <pws@xxxxxxx> wrote:
> Here's a test for the first bug.
>
> I didn't find one for the second: it's tied to reading commands line by
> line from the top-level loop and even running it as a script didn't trigger
> it for some reason.
>
> Index: Test/C03traps.ztst
> ===================================================================
> RCS file: /cvsroot/zsh/zsh/Test/C03traps.ztst,v
> retrieving revision 1.11
> diff -u -r1.11 C03traps.ztst
> --- Test/C03traps.ztst 29 May 2007 14:50:29 -0000 1.11
> +++ Test/C03traps.ztst 5 Aug 2008 08:32:02 -0000
> @@ -350,6 +350,44 @@
> >trap
> >Working 0
>
> + debug-trap-bug1() {
> + setopt localtraps
> + print "print bug file here" >bug-file
> + print "print this is line one
> + print this is line two
> + print this is line three
> + print and this is line fifty-nine." >bug-file2
> + function debug_trap_handler {
> + print $functrace[1]
> + do_bug
> + }
> + function do_bug {
> + . ./bug-file
> + }
> + trap 'echo EXIT hit' EXIT
> + trap 'debug_trap_handler' DEBUG
> + . ./bug-file2
> + }
> + debug-trap-bug1
> +0: Relationship between traps and sources
> +>debug-trap-bug1:15
> +>bug file here
> +>this is line one
> +>./bug-file2:1
> +>bug file here
> +>this is line two
> +>./bug-file2:2
> +>bug file here
> +>this is line three
> +>./bug-file2:3
> +>bug file here
> +>and this is line fifty-nine.
> +>./bug-file2:4
> +>bug file here
> +>debug-trap-bug1:16
> +>bug file here
> +>EXIT hit
> +
> %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