delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/12/15/19:10:29

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_RW,T_RP_MATCHES_RCVD
X-Spam-Check-By: sourceware.org
Message-ID: <4D0958E6.1040801@redhat.com>
Date: Wed, 15 Dec 2010 17:10:14 -0700
From: Eric Blake <eblake AT redhat DOT com>
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: Test command giving inconsistent results.
References: <726030B512B24D0AA5160CBB2B0CBB7D AT ahallpc>
In-Reply-To: <726030B512B24D0AA5160CBB2B0CBB7D@ahallpc>
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

--------------enigBE4E82B6931BFD171A08BA36
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

On 12/15/2010 05:04 PM, Andy Hall wrote:
> This is one in the same vein as the one I reported back in October.
>=20
> The test command is giving different results depending on the path used.

I'm not yet sure if it is a bug, or just a flaw in your expectations.

>=20
> ahall AT ahall-pc /cygdrive/c/Program Files/Java/j2sdk1.4.2_16/bin
> $ ls -l
> total 1320
> ... <Some files deleted for clarity>
> -rwx------+ 1 ahall None 45168 2007-09-17 02:27 java.exe
> ... <More files deleted for clarity>

Note that this file has ACLs.  To be a complete report, you should also
provide: getfacl java.exe as well as id output, to make sure we know
which ids have which permissions, and which id you are running as.

When you access the file via a POSIX name (such as it's relative path),
then access() uses POSIX permissions to determine who can read the file,
including checking against the ACLs.

> <Simple file name used.>
> ahall AT ahall-pc /cygdrive/c/Program Files/Java/j2sdk1.4.2_16/bin
> $ test -r java.exe && echo readable
> readable
>=20
> <Here the full path is used!>
> ahall AT ahall-pc /cygdrive/c/Program Files/Java/j2sdk1.4.2_16/bin
> $ test -r /cygdrive/c/j2sdk1.4.2_16/bin/java.exe && echo readable

But when you go through /cygdrive, then the default mount settings
assume noacl, and ACL checks are bypassed, which may change the results.

Then again, a relative path to a file within a noacl directory ought to
have the same behavior as the absolute path to the same file.  So maybe
there's a bug after all.

Would you mind also checking if /bin/test vs. bash's builtin test have
different behaviors, since coreutils and bash might be using slightly
different syscalls in implementing 'test -r'?

--=20
Eric Blake   eblake AT redhat DOT com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


--------------enigBE4E82B6931BFD171A08BA36
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJNCVjmAAoJEKeha0olJ0NqOBAH/3BqYIkCEKlQ62Aiavuz9GMl
iSmRMSJdbMyNlAUezwqGXzU1D2B3ZOOwiZ20e3WLnVKVqSAJJi7Oj6bZf4QRP3IL
vGcoWCIA2wDu1Yd+JPGePecjXQ43YdLwAR7aGfPQBNdiXMbMuLaS734tHjzmgp4M
C1jQ7IgTZmhHkOK8C3ejOKW9Fr7E6JQYZNkFr1uCLqPwc7d66GyOWBCWKc1zDhRI
OEZiv1eKNElHcVyPjtmmLDY+H0WKDnbgu7gNJvqNhYMi3e/gIBqLrnZ46vjVfkeO
CLw/Ytb08RGrZ58+tJ3nrzbn/UtGO/HafXLto+k9dX+wgOdV518utupnXOD4ZlQ=
=wI71
-----END PGP SIGNATURE-----

--------------enigBE4E82B6931BFD171A08BA36--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019