Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[BUG+PATCH] `zsh -n` shouldn't check for alias func def
- X-seq: zsh-workers 49378
- From: Marlon Richert <marlon.richert@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [BUG+PATCH] `zsh -n` shouldn't check for alias func def
- Date: Mon, 6 Sep 2021 19:28:10 +0300
- Archived-at: <https://zsh.org/workers/49378>
- List-id: <zsh-workers.zsh.org>
Using `zsh -n` to syntax check gives a false positive for this case,
which is valid syntax:
% zsh -nc 'unalias which-command; which-command() {}'
zsh:1: defining function based on alias `which-command'
zsh:1: parse error near `()'
This patch fixes that.
From 963ec42be4d6d980baa468307ee945bc515f0ca3 Mon Sep 17 00:00:00 2001
From: Marlon Richert <marlonrichert@xxxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 6 Sep 2021 19:24:23 +0300
Subject: [PATCH] Don't check for alias func defs when in NO_EXEC mode
---
Src/parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Src/parse.c b/Src/parse.c
index be26112a5..10d193ba1 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2052,7 +2052,7 @@ par_simple(int *cmplx, int nr)
/* Error if preceding assignments */
if (assignments || postassigns)
YYERROR(oecused);
- if (hasalias && !isset(ALIASFUNCDEF) && argc &&
+ if (isset(EXECOPT) && hasalias && !isset(ALIASFUNCDEF) && argc &&
hasalias != input_hasalias()) {
zwarn("defining function based on alias `%s'", hasalias);
YYERROR(oecused);
--
2.30.1 (Apple Git-130)
Messages sorted by:
Reverse Date,
Date,
Thread,
Author