zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Marlon Richert <marlon.richert@gmail.com>,
	Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [Bug?] zsh -n fails on dynamically named directory syntax
Date: Tue, 22 Jun 2021 14:23:51 +0100 (BST)	[thread overview]
Message-ID: <1491312124.296829.1624368231812@mail2.virginmedia.com> (raw)
In-Reply-To: <CAHLkEDvvGJrO6uC3G5mumndmnH8eK5Uygp0WuPTjdLQmY8hQVg@mail.gmail.com>


> 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) &&


      reply	other threads:[~2021-06-22 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18  7:48 Marlon Richert
2021-06-22 13:23 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1491312124.296829.1624368231812@mail2.virginmedia.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=marlon.richert@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).