mirror of
https://git.code.sf.net/p/zsh/code
synced 2026-04-18 06:53:35 -04:00
54285: 'let' builtin should return 2 if error occurred
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
2026-04-07 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
|
||||
|
||||
* 54285: Src/builtin.c, Test/C01arith.ztst: 'let' builtin
|
||||
should return 2 if error occurred
|
||||
|
||||
* unposted: Doc/Zsh/expn.yo: fix a reference to Arithmetic
|
||||
Evaluation.
|
||||
|
||||
|
||||
@@ -7501,8 +7501,11 @@ bin_let(UNUSED(char *name), char **argv, UNUSED(Options ops), UNUSED(int func))
|
||||
|
||||
while (*argv)
|
||||
val = matheval(*argv++);
|
||||
/* Errors in math evaluation in let are non-fatal. */
|
||||
errflag &= ~ERRFLAG_ERROR;
|
||||
if (errflag) {
|
||||
/* Errors in math evaluation in let are non-fatal. */
|
||||
errflag &= ~ERRFLAG_ERROR;
|
||||
return 2;
|
||||
}
|
||||
/* should test for fabs(val.u.d) < epsilon? */
|
||||
return (val.type == MN_INTEGER) ? val.u.l == 0 : val.u.d == 0.0;
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
|
||||
( unsetopt unset
|
||||
let noexist==0 )
|
||||
1:Arithmetic, NO_UNSET part 3
|
||||
2:Arithmetic, NO_UNSET part 3
|
||||
?(eval):2: noexist: parameter not set
|
||||
|
||||
print $(( "6+2" / "1+3" ))
|
||||
|
||||
Reference in New Issue
Block a user