From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.134]) by sourceware.org (Postfix) with ESMTPS id 8007C38618E2 for ; Tue, 13 Oct 2020 18:37:03 +0000 (GMT) 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@cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MKbPg-1kl30x1fNU-00L077; Tue, 13 Oct 2020 20:36:51 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id B447CA82BBE; Tue, 13 Oct 2020 20:36:50 +0200 (CEST) Date: Tue, 13 Oct 2020 20:36:50 +0200 From: Corinna Vinschen To: Mario Emmenlauer Cc: cygwin@cygwin.com Subject: Re: test -r or -x always return false on an NFS mount? Message-ID: <20201013183650.GW26704@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: Mario Emmenlauer , cygwin@cygwin.com References: <1279009444.20201006184606@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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=:EywQTLixB0AVBoaXwgKcLp fWeeaT0ZXfK9gFcOhrDAN7nPeLQo+xmA4bkdNeiROaMzCR4EL6icQlQSIXklpBUUmtnAYrJPw WRGBeN6nsnWF5ti8OdEZxPhMeLsqJY+TtkPUC5Q8+YdhdodKrB2pmDBYiku4oJku4LrhS+qUP 98aUbNkraM/vhkwE1Ce6rIFGaD1pU3VS7c+uENN0Q0yl7FOFC9HGdPucyx1ZylBZ0z5F9CS0C HYvDWLtVLB1Hmc/eEnbgPX6RUL4IW/8iCJ/bYl6OpR9xBErg9XQfywlnmkY4KXXQy0ayIVMsf d1LaM8XpB3XDmkMgI00GOYrffd0quB+0IN6XML2EQU1jzGpCQThr/MBMXt+ok3SuDvAOWUFLi QEj3D9ZuyrW9CUvTdTgg5QA2m0817GLilQ3exNighC6nIjyqtlCHS1/Bue5Ms5bRvzb2/bwg0 HGuWlCPgVdU/AeYJMOa9JJ5VHavTqkIxwCBOfwm6LiXZW+xjO2QYhAAe1vaHIIZUcpANVLOdD nNAP8wgIvq2cLzlK6cuvQmA8g0uPehDjgHAuCgNS/GXqMKcRcafD3rHdZz2BbWvGN0buDLCpB cHGNA/w7bwFU4Mwa8j53srINjOyFv1JUzK2GxCcQo3Hqg1YCpTtC8I16i65odm+h/g++FvXAH NaMMyrOT6bppj9LOKuaLWG2oZ0nGiBM4GfRCXf6ogY7cdJN9H5EyqZKRzPjA1PD2MbQZYLEDa zgMG6Ihif5JJRc9k+aHR18cYo9Z2dGCboKIj7lLmF0CLSqU3iGkjQFCtp6bLSCKD2w1Xo40zU Q/iLZ1n9Y3G93WliKePsvTX8tUOoSzLr5NQmKiKQbhvBT9pgVqfsHEH0MSlCUU5WnR8/XH22B DI2t9JD0BLUILiQCCndg== X-Spam-Status: No, score=-100.4 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, 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@cygwin.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: , X-List-Received-Date: Tue, 13 Oct 2020 18:37:05 -0000 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