Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [Bug?] zsh -n fails on dynamically named directory syntax
> On 18 June 2021 at 08:48 Marlon Richert <marlon.richert@xxxxxxxxx> wrote:
> Given
> * a script "foo.zsh" containing
> source bar.zsh
> print ~[foo]
> * a script "bar.zsh" that sets up dynamically named dirs, but which
> has _not_ been sourced in the current shell
>
> When
> * I do `zsh -n foo.zsh`
>
> Then
> * Command fails with
> foo.zsh:2: no directory expansion: ~[foo]
>
> Expected behavior:
> * I would expect `zsh -n foo.zsh` to succeed here, since the syntax in
> foo.zsh is entirely valid.
The point being that zsh -n is just syntax checking.
pws
diff --git a/Src/subst.c b/Src/subst.c
index 9928be0e9..87a56c3c6 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -765,7 +765,7 @@ filesubstr(char **namptr, int assign)
*namptr = dyncat(res, ptr2+1);
return 1;
}
- if (isset(NOMATCH))
+ if (isset(NOMATCH) && isset(EXECOPT))
zerr("no directory expansion: ~[%s]", tmp);
return 0;
} else if (!inblank(str[1]) && isend(*ptr) &&
Messages sorted by:
Reverse Date,
Date,
Thread,
Author