Subject: [BUG] Directory glob picks up running or already-run scripts on OS X
From: Zhiming Wang <[email-masked]>
To: [email-masked]
Date: Sat, 9 Jul 2016 11:55:05 +0800
List-Id: Zsh Workers List <zsh-workers.zsh.org>

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. Note that this seems to only apply to scripts, not random executables
(e.g., an executable created by a C compiler). Here's a session that reproduces
the issue:

    $ cd $(mktemp -d)
    $ print '#!/usr/bin/env zsh' >script1
    $ print $'#!/usr/bin/env zsh\nprint -l */' >script2
    $ chmod +x script1 script2
    $ print -l */
    zsh: no matches found: */
    $ ./script1
    $ print -l */
    script1/
    $ ./script2
    script1/
    script2/
    $ print -l */
    script1/
    script2/
    $ print $'#include <stdio.h>\nint main() { printf("hello, world"); }' >hello.c
    $ cc -o hello hello.c
    $ ./hello
    hello, world%
    $ print -l */
    script1/
    script2/

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.