From: dana <dana@dana.is>
To: Daniel Shahaf <danielsh@apache.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] A glob with a trailing slash will now match unreadable/unexecutable directories.
Date: Mon, 13 Jan 2020 00:24:22 -0600 [thread overview]
Message-ID: <E2CFE377-F8B5-457F-9C68-5EB6F4EE9985@dana.is> (raw)
In-Reply-To: <20200113002724.12708-1-danielsh@apache.org>
On 12 Jan 2020, at 18:27, Daniel Shahaf <danielsh@apache.org> wrote:
> This fixes the issue, but I'd appreciate some review.
The change seems good, though i only looked at it briefly.
A cool thing about it is that it apparently also fixes workers/42891 (globs
misbehaving with sudo on macOS). Not sure if there are cases where it'd still
be an issue, but a simple test (see below) run with root now passes where it
wouldn't before.
There is an issue with the D02 test you added before, though: Making the
directories unwriteable prevents ztst from cleaning up properly afterwards
(unless you're root), which causes other tests to fail the next time i run the
script:
% make check TESTNUM=D02
...
./D02glob.ztst: starting.
./D02glob.ztst: all tests successful.
rm: /Users/dana/Development/sf.net/zsh/zsh/Test/glob.tmp/secret-d000: Permission denied
rm: /Users/dana/Development/sf.net/zsh/zsh/Test/glob.tmp/secret-d111: Permission denied
rm: /Users/dana/Development/sf.net/zsh/zsh/Test/glob.tmp: Directory not empty
...
% make check TESTNUM=D02
...
./D02glob.ztst: starting.
...
Test ./D02glob.ztst failed: output differs from expected as shown above for:
( regress_absolute_path_and_core_dump )
Was testing: exclusions regression test
./D02glob.ztst: test failed.
...
dana
diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 50b0f6716..0d4fde2f9 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -741,3 +741,14 @@
>glob.tmp/secret-s000/ glob.tmp/secret-s000
>glob.tmp/secret-s111/ glob.tmp/secret-s111
>glob.tmp/secret-s444/ glob.tmp/secret-s444
+
+ # On macOS, stat(2) allows files to be treated as directories if the calling
+ # process has super-user privileges. e.g., stat() on /my/regular/file/. will
+ # succeed as root but (correctly) fail otherwise. This can produce strange
+ # results when globbing, depending on how it's implemented. This test should,
+ # when run with privileges, confirm that the implementation avoids this
+ # problem. See workers/42891 and workers/45291
+ : > glob.tmp/not-a-directory
+ print -r - glob.tmp/not-a-dir*(N) , glob.tmp/not-a-dir*/(N)
+0:non-directories not globbed as directories
+>glob.tmp/not-a-directory ,
next prev parent reply other threads:[~2020-01-13 6:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200113002821eucas1p2884acfad76834011d777bf81f0562c50@eucas1p2.samsung.com>
2020-01-13 0:27 ` Daniel Shahaf
2020-01-13 6:24 ` dana [this message]
2020-01-13 16:41 ` Daniel Shahaf
2020-01-13 9:46 ` Peter Stephenson
2020-01-13 16:34 ` Daniel Shahaf
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=E2CFE377-F8B5-457F-9C68-5EB6F4EE9985@dana.is \
--to=dana@dana.is \
--cc=danielsh@apache.org \
--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).