zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: [PATCH] Tests for globbing below protected directories
Date: Sun, 24 Jan 2021 16:15:23 -0800	[thread overview]
Message-ID: <CAH+w=7bwDpyu0Anj5wpQ-v+ATFZ7fvqfz9RSeoE6ahRu=QVGLQ@mail.gmail.com> (raw)

Does this test look as expected?  Note there are trailing spaces on
the "print -raC 2" output, which surprised me but has nothing to do
with the test itself.

This doesn't test for the CASEGLOB issue last mentioned in workers/47832.

diff --git a/Test/D02glob.ztst b/Test/D02glob.ztst
index 176846d46..d3b2e9ec2 100644
--- a/Test/D02glob.ztst
+++ b/Test/D02glob.ztst
@@ -741,6 +741,23 @@
 >glob.tmp/secret-s111/  glob.tmp/secret-s111
 >glob.tmp/secret-s444/  glob.tmp/secret-s444

+ for 1 in 000 111 444 ; do
+  chmod 777 glob.tmp/secret-d$1
+  touch glob.tmp/secret-d$1/file
+  mkdir -m 777 glob.tmp/secret-d$1/dir
+  touch glob.tmp/secret-d$1/dir/file
+  chmod $1 glob.tmp/secret-d$1
+ done
+ print -raC 2 -- glob.tmp/secret-*/* glob.tmp/secret-*/file
+0:names inside unreadable directories can be globbed if searchable
+>glob.tmp/secret-d444/dir   glob.tmp/secret-d444/file
+>glob.tmp/secret-s444/dir   glob.tmp/secret-s444/file
+>glob.tmp/secret-d111/file  glob.tmp/secret-s111/file
+
+ print -rC 2 -- glob.tmp/secret-*/dir/*
+0:glob files in readable directories inside unreadable directories
+>glob.tmp/secret-d111/dir/file  glob.tmp/secret-s111/dir/file
+
  # 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


             reply	other threads:[~2021-01-25  0:15 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  0:15 Bart Schaefer [this message]
2021-01-26 23:56 ` Daniel Shahaf
2021-02-02  2:45   ` Bart Schaefer
2021-02-03 11:22     ` Daniel Shahaf
2021-02-03 22:33       ` Bart Schaefer
2021-02-03 23:06         ` Bart Schaefer
2021-02-04 13:09           ` Daniel Shahaf
2021-02-04 21:34             ` Bart Schaefer
2021-02-06 12:15               ` 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='CAH+w=7bwDpyu0Anj5wpQ-v+ATFZ7fvqfz9RSeoE6ahRu=QVGLQ@mail.gmail.com' \
    --to=schaefer@brasslantern.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).