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]

bash [ -f filename ] behavior


When building XFree86 from CVS under Cygwin you may encounter a problem
where 'make World' reports that a file 'imake' cannot be moved because it
does not exist.

I have looked into this problem extensively, and it is due to bash behaving
differently under Cygwin than it does under Linux.  However, I believe it
deserves to at least be brought to light.

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.

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.

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.

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...

(I'm not on the Cygwin list, just the Cygwin/XFree86 list, so Cygwin people
please CC me.  Thanks.)

Harold 

--
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]