Subject: Re: [BUG] Directory glob picks up running or already-run scripts on OS X
From: Bart Schaefer <[email-masked]>
To: Zhiming Wang <[email-masked]>
Cc: Zsh hackers list <[email-masked]>
Date: Sun, 10 Jul 2016 13:12:15 -0700
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Fri, Jul 8, 2016 at 8:55 PM, Zhiming Wang <[email-masked]> wrote:
> With zsh 5.2 or master running on OS X 10.11.5 or macOS 10.12 PB1, a glob for
> directories could pick up scripts that are either running or have been
> run.

I'm not able to reproduce this.  I happen to have an iMac that was
upgraded to El Capitan (10.11.5) only yesterday.  This morning I did
the following:

1. Install xcode and agree to the license.
2. Download automake and autoconf from ftp.gnu.org, build, install.
3. Pull the latest zsh from sourceforge git.
4. Recompile zsh with static module linkage so I can run from the build tree
5. Run: Src/zsh -f
6. Attempt to reproduce using your steps, modified a little because
"env zsh" won't find the binary I want.

macadamia% cd $(mktemp -d)
macadamia% print $'#!/usr/bin/env zsh' >script1
macadamia% print $'#!/usr/bin/env zsh\nprint -l */' >script2
macadamia% chmod +x script1 script2
macadamia% print -l */
zsh: no matches found: */
macadamia% ~-/Src/zsh -f script1
macadamia% print -l */
zsh: no matches found: */
macadamia% ~-/Src/zsh -f script2
script2:2: no matches found: */
macadamia% uname -a
Darwin macadamia.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19
18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64
macadamia% print $ZSH_PATCHLEVEL
zsh-5.2-310-g304aa25

> I cannot reproduce this issue with zsh 5.0.8 on OS X, so something went wrong
> in between. Unfortunately, due to some limitations I cannot test other versions
> right now. I also cannot repoduce this issue on Linux with any zsh version
> (including 5.2 or master), so this seems to be an OS X specific issue.

This may even be a compiler-specific issue.  Note that I'm
deliberately using the stock compiler with neither homebrew nor
macports and minimal GNU tool install.

What did you use to build zsh?