Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Bug with "return" from inside "if"
- X-seq: zsh-workers 39839
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Bug with "return" from inside "if"
- Date: Sat, 5 Nov 2016 13:25:09 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:to:subject:mime-version; bh=ZoOKWq+ppSSr8CrjRVUp2AycZKcRZ6MacnUKytSeLFk=; b=c3h+C4G4ErxYSjTFyCLpwgZJeA/KEKZA4HbFb8USf7cHxl6qmPB4s/wwWGKBcAEYLs iRqlXwF+FdE7JRerQplXAgiYC9DfDLnlKPdxDZ6nx+PFnqkEboYSFTrsgcc6P0MFyFob KcmLxyizemFigf8Ob3wrNOWQuE/oc38nbU6cFTnaNXgwfpuGYyLATCqQolv2P6DS1UbP Wux0ag6UYbKIe4V4yluqnLFcKBQsGtFoJaP/G6zCE3mrpK6zPA0apCq3jHfKsB5mBHpo Ea5z+s8LrR+DeiojBl/gp5LYqcy2Jin/7e2BolBd2cF6/NPbRe8RPclIuLR6CTJKKViR FoOg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
% () { if return 1; then echo yes; else echo no; fi } && echo $?
0
This goes back at least as far as zsh 4.2.
diff --git a/Src/loop.c b/Src/loop.c
index b791a89..f65c72b 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -570,7 +570,8 @@ execif(Estate state, int do_exec)
cmdpop();
} else {
noerrexit = olderrexit;
- lastval = 0;
+ if (!retflag)
+ lastval = 0;
}
state->pc = end;
Messages sorted by:
Reverse Date,
Date,
Thread,
Author