zsh-workers
 help / color / mirror / code / Atom feed
* [Bug?] zsh -n fails on dynamically named directory syntax
@ 2021-06-18  7:48 Marlon Richert
  2021-06-22 13:23 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Marlon Richert @ 2021-06-18  7:48 UTC (permalink / raw)
  To: Zsh hackers list

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.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Bug?] zsh -n fails on dynamically named directory syntax
  2021-06-18  7:48 [Bug?] zsh -n fails on dynamically named directory syntax Marlon Richert
@ 2021-06-22 13:23 ` Peter Stephenson
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Stephenson @ 2021-06-22 13:23 UTC (permalink / raw)
  To: Marlon Richert, Zsh hackers list


> On 18 June 2021 at 08:48 Marlon Richert <marlon.richert@gmail.com> 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) &&


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-22 13:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-18  7:48 [Bug?] zsh -n fails on dynamically named directory syntax Marlon Richert
2021-06-22 13:23 ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).