From: Mario Emmenlauer <mario@emmenlauer.de>
To: cygwin@cygwin.com
Subject: Re: test -r or -x always return false on an NFS mount?
Date: Tue, 6 Oct 2020 18:10:55 +0200 [thread overview]
Message-ID: <c5adbabd-f6c1-7a09-2af2-fdd819b76cdf@emmenlauer.de> (raw)
In-Reply-To: <1279009444.20201006184606@yandex.ru>
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`?
Cheers,
Mario Emmenlauer
next prev parent reply other threads:[~2020-10-06 16:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-22 20:14 Mario Emmenlauer
2020-10-01 10:22 ` Mario Emmenlauer
2020-10-06 1:41 ` Ken Brown
2020-10-06 15:46 ` Andrey Repin
2020-10-06 16:10 ` Mario Emmenlauer [this message]
2020-10-13 18:36 ` Corinna Vinschen
2020-10-13 19:00 ` Mario Emmenlauer
2020-10-14 8:28 ` Corinna Vinschen
2020-10-14 9:06 ` Mario Emmenlauer
2020-10-14 11:50 ` Corinna Vinschen
2020-10-14 14:57 ` Mario Emmenlauer
2020-10-15 8:16 ` Corinna Vinschen
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=c5adbabd-f6c1-7a09-2af2-fdd819b76cdf@emmenlauer.de \
--to=mario@emmenlauer.de \
--cc=cygwin@cygwin.com \
/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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).