From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 47c17ca9 for ; Mon, 13 Jan 2020 06:25:10 +0000 (UTC) Received: (qmail 21850 invoked by alias); 13 Jan 2020 06:25:00 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45292 Received: (qmail 8050 invoked by uid 1010); 13 Jan 2020 06:25:00 -0000 X-Qmail-Scanner-Diagnostics: from mail-yw1-f65.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25691. spamassassin: 3.4.2. Clear:RC:0(209.85.161.65):SA:0(-1.9/5.0):. Processed in 2.015974 secs); 13 Jan 2020 06:25:00 -0000 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.161.65 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=lO7eZaq7oKBZV+gILtaH7sh2UY6vRl2cbhMQbajXsJQ=; b=jfehhoqUga2R5e4VHEslQwgaoSuuUQP4cpq4dgg4P5oYkbj8mj1zvCqpnylo4bMYbF jSfe/p5ppgqTU9E2Ci1fLwkuzJlbjZ69n5uAwp6GPKyq3gjKTCpvOPLpXdyE9hyGsydt 5zrrcqWUItADQymDjopsDHOAqVNgctmwNngHYNNqryP5C1s0/a+KcO2eGlr0bFA/khnk HFSoOr2TcGFXYUtIH706xA8BnKyiP6YiOINLTCb8HO0I/g0jpWDTVUneI4PxHSbzopQN 1UDPaPq9qoBiVhP+Ot7+fWuqjAszroHx5gj7Z0KxW0bO270Y6WCnEogLDNERWbpm3eS5 Wbjg== X-Gm-Message-State: APjAAAWaxDHslVYX/ISeJ/NL4aNQDVO+xcWd0eBb0Vev6+HVEL3S0y04 LTa037ajqWalyPnwVA3fP6C9gzhJmtP/lg== X-Google-Smtp-Source: APXvYqxBm9gr+16R8cWlHW+9cYxyzoV4HVFRFhATE8+Oh7/npSyah+RBGqWmYJqe/GDmc/2cYYTNjQ== X-Received: by 2002:a5b:9c3:: with SMTP id y3mr7969461ybq.414.1578896664269; Sun, 12 Jan 2020 22:24:24 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH] A glob with a trailing slash will now match unreadable/unexecutable directories. From: dana In-Reply-To: <20200113002724.12708-1-danielsh@apache.org> Date: Mon, 13 Jan 2020 00:24:22 -0600 Cc: Zsh hackers list Content-Transfer-Encoding: quoted-printable Message-Id: References: <20200113002724.12708-1-danielsh@apache.org> To: Daniel Shahaf X-Mailer: Apple Mail (2.3445.104.11) On 12 Jan 2020, at 18:27, Daniel Shahaf 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=3DD02 ... ./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=3DD02 ... ./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 ,