[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [FYI] {master} maint: assume 'test -x' is portable

From: Eric Blake
Subject: Re: [FYI] {master} maint: assume 'test -x' is portable
Date: Mon, 27 Feb 2012 12:56:04 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

On 02/27/2012 07:51 AM, Peter Rosin wrote:
>> Thanks for chiming in.  I still haven't pushed my proposed patches to
>> autoconf, and I'd like to make sure that what I'm proposing for autoconf
>> still gets by on your MSYS system (I don't have MSYS set up myself, so
>> getting feedback from you would be fastest).  I assume that some of MSYS
>> behavior on FAT is similar to cygwin on FAT, and I have been testing
>> Cygwin on FAT, but I also know that Cygwin and MSYS have diverged so
>> that is not necessarily a reliable result.
> Note, this is all MSYS on NTFS, no FAT in sight.

Yuck.  NTFS supports executable bits, without having to fake things so
horribly, as evidenced by cygwin; cygwin only has to fake things on FAT.
 So it was a specific decision of the MSYS folks to fake it this badly.

>> You didn't show $? nor 'ls -l' after 'chmod +x', but your transcript
>> implies that since the filesystem can't record executable bits, that
>> chmod is silently ignored, and the faking of executability is still
>> being done.
> $ touch gurka
> $ ./gurka; echo $?
> 0

That's a POSIX violation.  Oh well - MSYS wasn't really trying for
POSIX, so much as bare minimum hacks to get things running for native
Windows, and this is just one of those hacks.

> $ ls -lG gurka
> -rw-r--r-- 1 peda 0 Feb 27 15:39 gurka
> $ chmod +x gurka; echo $?
> 0
> $ ls -lG gurka
> -rw-r--r-- 1 peda 0 Feb 27 15:39 gurka

Sure enough, chmod is (silently) ignored, because permissions are being
faked; but it's a shame that 'x' doesn't appear in the ls -l output in
the case of the permissions being faked.

>> Once I know those behaviors, I think I can ensure that my proposed test
>> to require a "working" 'test -x' as a pre-req of finding a sane shell
>> should still work for MSYS.
> $ test -x /; echo $?
> 0

Good - this will pass the 'minimum support for test -x' probe that I'm
sticking into configure.

> $ test -x .; echo $?
> 0
> $ printf '#!/bin/sh\nexit 0\n' >
> $ ./; echo $?
> 0

Good - even though there are no x bits, the test that I'm adding to the
autoconf testsuite is smart enough to recognize that if the script
_gets_ executed,...

> $ test -x; echo $?
> 0

...and 'test -x' says it could be executed, in spite of the missing 'x'
bits, then the test will pass in spite of the brokenness of the 'x'
semantics on that file system.

> $ chmod a+x; echo $?
> 0
> $ ./; echo $?
> 0
> $ test -x; echo $?
> 0

So I'm pretty sure that I'm safe to check in my patches without causing
grief for MSYS, although if you'd test the pre-release before 2.69, it
can't hurt things.  I hope to have the pre-release announcement out
later today.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]