This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: -x weirdness
- From: "Gerrit P. Haase" <gp at familiehaase dot de>
- To: Benoit Rochefort <Benoit dot Rochefort at gerad dot ca>
- Cc: cygwin at cygwin dot com, benoitr at ad-opt dot com
- Date: Mon, 18 Aug 2003 23:28:42 +0200
- Subject: Re: -x weirdness
- Organization: Esse keine toten Tiere
- References: <16193.14627.802702.855384@scicily.montreal.ad-opt.com>
- Reply-to: "Gerrit @ cygwin" <cygwin at cygwin dot com>
Hallo Benoit,
you wrote:
> When I installed cygwin, permissions on all the distribution looks like:
> ###############################################################################
> $ ls -al /usr/bin/bash
> -rwx------+ 1 Administ Domain U 531968 Mar 13 04:29 /usr/bin/bash*
> ###############################################################################
> As you can see, even if I am:
> ###############################################################################
> $ id
> uid=17199(benoitr) gid=10513(Domain Users) groups=10513(Domain Users),11121(Exceed Users)
> ###############################################################################
> I can however run bash and every other programs. I suppose
> it is a Windoze weirdness. But, what is interesting is "How
> can I know if a program can be executed"? Often, I write
> scripts where the flow of control depend on the availability
> of a particular program.
> So check this out:
> ###############################################################################
> $ [ -x /usr/bin/bash ]; echo $?
> 0
> $ /usr/bin/test -x /usr/bin/bash; echo $?
> 1
> $ perl -e 'print -x "/usr/bin/bash" ? 0 : 1 , "\n"'
> 1
> ###############################################################################
> I guess only bash is correct...
> Looking at the source code of bash (in test.c), we discover
> what seems to be the "correct" way of guessing if a program
> can be executed:
> case 'x': /* File is executable? */
> return (EACCESS (arg, X_OK) == 0);
> where EACCESS is:
> #if defined (AFS) || defined (__CYGWIN__)
> # define EACCESS(path, mode) access(path, mode)
> #else
> # define EACCESS(path, mode) test_eaccess(path, mode)
> #endif /* AFS */
> I'd like to know if:
> Someone will notice and eventually correct the bug
> - or -
> I'm wrong, this is not a bug
> - or -
> Tell me a way to interprete these results.
> Do I have to mail this problem to a perl mailing list?
Nope. Seems to be a bug in your perl version. Which version are you
using right now? I consider the 5.8.0 series will be removed from the
mirrors soon, I was not very happy with it. 5.6.1-2 will stay and
eventually be updated to use cygwin-1.5.2 and probably also some day
in future there will be a 5.6.2 release, I'll look into this issue if
it is a bug in 5.6.x, and my 5.8.1-tobe snapshot with cygwin 1.5.2
does it the correct way:
$ perl -e 'print -x "/usr/bin/bash" ? 0 : 1 , "\n"'
0
$ perl -e 'print -x "/usr/bin/bash.exe" ? 0 : 1 , "\n"'
0
$ perl -v
This is perl, v5.8.1 built for cygwin-multi-64int
(with 1 registered patch, see perl -V for more detail)
...
Gerrit
--
=^..^=
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/