delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/10/10:20:13

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
Subject: RE: 1.7.1: dash/ash test -x broken?
Date: Wed, 10 Feb 2010 09:18:10 -0600
Message-ID: <EADE84D0102AB145A5BEA7A5A00CD90101FB9DE2@XMBIL131.northgrum.com>
In-Reply-To: <4B721A11.8050108@byu.net>
References: <1265746240 DOT 20790 DOT ezmlm AT cygwin DOT com> <EADE84D0102AB145A5BEA7A5A00CD90101FB9DE1 AT XMBIL131 DOT northgrum DOT com> <4B721A11 DOT 8050108 AT byu DOT net>
From: "Cobb, Christopher (Contr) (IS)" <Christopher DOT Cobb AT ngc DOT com>
To: "Eric Blake" <ebb9 AT byu DOT net>, <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

(I hate Outlook 2007.  If someone can tell me how to make it
mailing-list friendly, I will post correctly next time).

Thank you for your response.  Here is what I have:

$ JAVACMD=3D"/c/Program Files/Java/jdk1.5.0_18/bin/java"

$ bash -c "test -x '$JAVACMD';"' echo $?'
0

$ dash -c "test -x '$JAVACMD';"' echo $?'
1

$ ash -c "test -x '$JAVACMD';"' echo $?'
1

$ getfacl.exe "$JAVACMD"
# file: /c/Program Files/Java/jdk1.5.0_18/bin/java
# owner: Administrators
# group: SYSTEM
user::rwx
group::rwx
group:Users:r-x
group:Power Users:rwx
mask:rwx
other:---

$ stat "$JAVACMD"
  File: `/c/Program Files/Java/jdk1.5.0_18/bin/java'
  Size: 53344           Blocks: 56         IO Block: 65536  regular file
Device: 548b6deeh/1418423790d   Inode: 1407374883580908  Links: 1
Access: (0770/-rwxrwx---)  Uid: (  544/Administrators)   Gid: (   18/
SYSTEM)
Access: 2010-02-09 16:23:09.702221400 -0500
Modify: 2009-02-25 01:47:30.000000000 -0500
Change: 2009-11-19 15:03:03.707455600 -0500

$ id
uid=3D720693(cobbch) gid=3D10513(Domain_Users)
groups=3D0(root),544(Administrators),545(Users),1004(SophosUser)

........

I also see the same thing with -w:

$ bash -c "test -w '$JAVACMD';"' echo $?'
0

$ dash -c "test -w '$JAVACMD';"' echo $?'
1

$ ash -c "test -w '$JAVACMD';"' echo $?'
1

-----Original Message-----
From: Eric Blake [mailto:ebb9 AT byu DOT net]=20
Sent: Tuesday, February 09, 2010 9:30 PM
To: cygwin AT cygwin DOT com; Cobb, Christopher (Contr) (IS)
Subject: Re: 1.7.1: dash/ash test -x broken?

According to Cobb, Christopher (Contr) (IS) on 2/9/2010 1:30 PM:
> I recently upgraded to 1.7.1.
>=20
> I have noticed that dash/ash shell scripts which test for the=20
> executability of files don't work.  For example, the maven build=20
> application comes with a 'mvn' script which contains this line:
>=20
>    if [ ! -x "$JAVACMD" ] ; then
>       print error message
>    fi

Works for me with all my testing so far:

$ touch f1 f2
$ chmod 000 f1
$ chmod 777 f2
$ bash -c 'test -x f1; echo $?'
1
$ bash -c 'test -x f2; echo $?'
0
$ dash -c 'test -x f1; echo $?'
1
$ dash -c 'test -x f2; echo $?'
0

For me to reproduce your failure, I would need more details.  I'm
wondering if it might be an ACL issue.  What do 'id', 'stat "$JAVACMD"',
and 'getfacl "$JAVACMD"' state about the permissions on that file and
the permissions you are supposed to be able to have?

That said, I haven't yet looked into the source code; if it IS an ACL
issue, then it is a question of dash using stat() instead of access()
(or even better, euidaccess/faccessat).

--
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9 AT byu DOT net


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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