delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/06/24/13:13:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=Tc3+mPUG11mynsHGRAvk77py6QLT3geqj9VIUmrR/qKBdY6TWffc5
FU9VxBV76RRTu0B8aal6Qm+7gPBvNbnAjjgPPyv51IW0L55VqSMPr90GGNIyJa1h
QmmnCy4bGN2hKPSl5AbZ9cMPs0mYTTWCmzE0kIMiVUazEvHDpfgEbk=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=QeY0mjXc3QMc/ykUzTRgcm6kqtk=; b=MGnsjwgk1BMui96F4C7yR2wpKJGR
SweRflGE3oCnlYGlN28WTL566AZwdJXBJziMTEFrL0OkbD9rvLvu5In/IJnLfKGu
e7/MoWvXGRu8hNE9jbDaN7WQ41Y5/nLU7Xk3MNDj+w7xrXuCv8fQuMxsAP2zbZxX
QNzO89a6rYvsUfk=
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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-4.6 required=5.0 tests=AWL,BAYES_50 autolearn=ham version=3.3.2
X-HELO: calimero.vinschen.de
Date: Tue, 24 Jun 2014 19:13:06 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: LDAP integration / ACL in Perl revisited
Message-ID: <20140624171306.GK1803@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <loom DOT 20140624T134009-507 AT post DOT gmane DOT org>
MIME-Version: 1.0
In-Reply-To: <loom.20140624T134009-507@post.gmane.org>
User-Agent: Mutt/1.5.23 (2014-03-12)

--cN519qCC4CN1mUcX
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jun 24 12:18, Achim Gratz wrote:
> I've just set up a new machine with Cygwin (64bit w/ the 2014-06-23 13:20=
:35
> snapshot), nsswitch.conf specifies "db" for both passwd and group (the fi=
les
> have been moved away just to be sure they aren't picked up).  I have one
> share with somewhat strange ACL that I always had to use via a "noacl" mo=
unt
> option.  I thought I should try again and this is what happened (bla is a
> file that has non-zero size and is owned by me):
>=20
> (1014) > getfacl bla
> # file: bla
> # owner: gratz
> # group: Domain Users
> user::---
> group::---
> group:+Authenticated Users:rwx
> mask:rwx
> other:---

^^^^^^^ This... (*)

> (1015) > [ -r bla ] && echo Hello...
> Hello...
> (1018) > perl -E 'say -R "bla" ? "yes" : "no"'
> no
> (1016) > perl -E 'say -r "bla" ? "yes" : "no"'
> no
> (1017) > perl -E 'say -O "bla" ? "yes" : "no"'
> yes
>=20
> So for whatever reason Perl still doesn't deal correctly with those ACL,
> while the shell test operator does.  Now the kicker: if I run Perl under
> strace, the test succeeds... huh?

Without pulling strace into the picture, I get different results for -O
depending on whether running this on the command line as above, or if I
run this via a perl script.  I prepared a file with permissions
equivalent to the above getfacl output:

  $ getfacl bla
  # file: bla
  # owner: corinna
  # group: vinschen
  user::---
  group::---
  group:+Authenticated Users:rwx
  mask:rwx
  other:---

This results in=20

  $ perl -E 'say -R "bla" ? "yes" : "no"'
  no
  $ perl -E 'say -r "bla" ? "yes" : "no"'
  no
  $ perl -E 'say -O "bla" ? "yes" : "no"'
  yes

But when I run this via a perl script:

  $ cat > x.pl <<EOF
  use v5.10;
  say -R bla ? "yes" : "no";
  say -r bla ? "yes" : "no";
  say -O bla ? "yes" : "no";
  EOF
  $ perl x.pl
  no
  no
  no

I didn't try to debug this.

>    26  556465 [main] perl 5712 path_conv::check: this->path(\\share\bla),
> has_acls(1)
>    34  556499 [main] perl 5712 build_fh_pc: fh 0x18032C9F0, dev 000000C3
>    27  556526 [main] perl 5712 stat_worker: (\??\UNC\share\bla, 0x6000394=
98,
> 0x18032C9F0), file_attributes 32
> 12380  568906 [main] perl 5712 fhandler_base::fstat_helper: 0 =3D fstat
> (\??\UNC\share\bla, 0x600039498) st_size=3D228, st_mode=3D0x81A4,

(*) ...does not match that .........................^^^^^^^^^^^^^^

The getfacl permissions look like the last 9 bits of st_mode should have
been 000 octal, but the above st_mode is equivalent to 0644 permissions.
That's weird.  It does not happen for me, st_mode is 0100000, as expected.

If perl really only calls stat to check the POSIX permission bits (as
the strace output suggests, I checked mine), that would account for the
"no" in the -r/-R case.  What it should do is calling euidaccess/access,
or faccessat as test(1) does.

Since test(1) is doing the right thing and returning the right results,
I'm blaming perl for now.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--cN519qCC4CN1mUcX
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJTqbGiAAoJEPU2Bp2uRE+g9nkP/1Q7V0aMdc8344KyiBWy5JU2
uVnhlmUTZkKYj/5DJfjTkd9uw3A7JKit9PRusp8OCEuk2NI47ffPW4Eej15xsfLc
LO2sO8e8hPatbplVIgrtS7WwdxAbLSB5H7dcPQk/L6mygyiKm7Lu9a3QCPqlHmK3
OpPp4ayBMwVeQY+3Oqo37LJnxiDbFV0rrlW7HaaYBSwtIhAqWEM+77oAyE8lS2rC
X5MTzfg/sxuXhtwh+uHFCyoasyQbNWHGgTz9gKpvr/2JAxUhmRSWboc3BV3bRFng
Orpo//bRkFldtnepeSvake+x4ViLRMpSDW1FvNbxV4fa2TJYZXfuSm66MiC1yINo
se//qZ/gQt+NOdjIkhMweiJeV9nb5A073HCGIeoQqBVvkYyqylR373PAEXEjfVYP
zMcByVt7nfHvMbDcc6X/jOYZAk00Vgjv02YGFI7rUdPjRq2uFWw1Vz9RQ2aOHiCS
bG9Js6nafkrq6+Efxpq/eKMEpXABGTUqJau84D3IOoHbghF4+Wmbj1NZ7ABdt8vJ
X9Adu3XuLrT3Rf3gWSlXRejhjXTQsM7UOW+s/fgDmsS376yMn2GR7T5NBtei2+6O
zPP10ogSpAkGAN6dHUO64nTJHhMHtab5XlKKDql4TApz5IBPoyrIa/JJHsR0BhSQ
w3F39OwizfTLguuRr5dn
=2/Ce
-----END PGP SIGNATURE-----

--cN519qCC4CN1mUcX--

- Raw text -


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