X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7525E3887038 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1602614226; bh=+IrA0ZjKcJeONRXc/A+Sg0BChjpS/YKYO2gPWdwr8d4=; h=Date:From:To:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:Cc:From; b=HWV+4l4806dbnr6vK1J2TN7Ga3EDHhV36h9gcI9cbrH7nvYj9PtoYf50R8qUuI/aF xCN6QBa2htG7hW8TSYmPOJJRBuX/pNwHYJIL/1nO/sN9sGO+ps4//H2ry8KNAWfV8m yQTW1KTpdOPK1UMjtvudoYSL0kddWcL3aS7iF5XI= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8007C38618E2 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin AT cygwin DOT com Date: Tue, 13 Oct 2020 20:36:50 +0200 From: Corinna Vinschen To: Mario Emmenlauer Subject: Re: test -r or -x always return false on an NFS mount? Message-ID: <20201013183650.GW26704@calimero.vinschen.de> Mail-Followup-To: Mario Emmenlauer , cygwin AT cygwin DOT com References: <1279009444 DOT 20201006184606 AT yandex DOT ru> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:gWUkCudl9ntFn26naextpro6F7L0lvNovVv+alRLtVcS849L+Eo lmi427md4GouTUnVUXOiFia0+GZMwOgYOu1wtUmT8Wo7bA7/v3NbpeqaKGw+Tt7tAfT9ZOS kLDbUABLVedmc4+v9eLfqryTOb02uPp1O0rBAGVbqz4SocubreEfnDZF1Vl04B/OMAuytR1 5Q9QC0tzL+t+PlPHmre4g== X-UI-Out-Filterresults: notjunk:1;V03:K0:wVQtnenANj4=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TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Cc: cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" On Oct 6 18:10, Mario Emmenlauer wrote: > > Dear Andrey, > > On 06.10.20 17:46, Andrey Repin wrote: > > Greetings, Mario Emmenlauer! > > > >> thanks for the awesome Cygwin, its really great! > > > >> Everything seems to work quite well, and in `ls -la` I can see the > >> file permissions and user and group entries. But when using `test` > >> to check for read (`test -r`) or execute permissions (`test -x`), it > >> always returns false, even for readable files. `ls` on the other hand > >> shows the permissions correctly, and `cat`ing the files works without > >> problems. > > > > This is a known issue. For years known. > > test only guess -r/-w/-x results based on permissions as it sees them. > > But it do not actually try to read/write/execute the subject, which, as you > > can imagine, may lead to all sorts of false positives/negatives on filesystems > > with less than trivial access control setups. > > In other words, don't test for rwx if you can avoid it. The results MAY be > > wrong. > > > Ok, this explains a lot, and I almost guessed as much! But can I ask, > do you happen to know why `ls -l` shows the "correct" permissions > including 'r' and 'x'? It seems `ls` has some magic that `test` is > lacking? And I can not imagine that `ls` would try to open every > file, or does it?. > > So could this "magic" be ported from `ls` to `test`? There's something fishy in your environment. NFS permissions from NFS shares mounted via Microsoft's NFSv3 are read using some internal function I got hinted at by the MSFT NFS guys at one point. This information is then exported as mode bits by Cygwin's stat(2) and used accordingly by Cygwin's access(2). Having said that, there's *no* magic at all in the user space applications other than using Cygwin's stat(2) and access(2) functions. Consequentially, using Cygwin's ls(1) or test(1) from coreutils, the results are the expected ones in both cases; just tried it myself, just to be sure. So, what's fishy? I don't know, but maybe you're using a non-Cygwin test(1) accidentally? Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple