This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: 1.7.1: dash/ash test -x broken?


(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="/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=720693(cobbch) gid=10513(Domain_Users)
groups=0(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@byu.net] 
Sent: Tuesday, February 09, 2010 9:30 PM
To: cygwin@cygwin.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.
> 
> I have noticed that dash/ash shell scripts which test for the 
> executability of files don't work.  For example, the maven build 
> application comes with a 'mvn' script which contains this line:
> 
>    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@byu.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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]