This is the mail archive of the cygwin@sources.redhat.com 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]

Re: bash [ -f filename ] behavior


On Sun, Oct 01, 2000 at 10:54:28PM -0400, Harold Hunt wrote:
>Make a bash script file containing the following line:
>if [ -f imake ]; then mv imake imake.foo; fi
>
>Follow these steps under Cygwin's Bash:
>
>Run the script in a directory with no files named imake or imake.exe.  The
>script will detect that imake does not exist, so it will not attempt to move
>the file.

FYI, the shell that make will use, by default, in a normal Cygwin
installation is 'ash' (aka /bin/sh), not 'bash'.

>Run 'touch imake', then run the script again.  The script will move file
>imake to imake.foo, as it should.
>
>Run 'touch imake.exe', then run the script again.  The script will think
>that a file named 'imake' exists, even though it doesn't; the script will
>then attempt to move file 'imake', which does not exist, and the script will
>fail.

Cygwin's stat() function has historically always found a 'foo.exe' when
passed a 'foo' argument.

>Now, run the same steps under Linux's Bash, and you'll notice that the
>script does not get confused when a file named 'imake.exe' exists.

I'm sure that you can find many many many similar observations of this
sort on the cygwin mailing list over the years if you want to search
the archives.

>This bug, or feature (as it may help compatibility), currently causes
>XFree86 to fail when building under Cygwin.  I'm going to send in a
>patch to XFree86 to check for 'imake.exe' before checking for 'imake';
>that will fix the build bustage for now.  But, I figure the Cygwin guys
>might want to evaluate whether this is really desired behavior...

It's long standing behavior.  I have no idea what would break if we
changed it now.

cgf

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


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