Create file on remote node, immediate test-r fails intermittently
Thu Jun 14 04:54:00 GMT 2001

I'm working as a consultant in a client that is moving a large Oracle
application from Unix to Windows 2000. I have been using Cygwin and Bash to
provide an environment to run some of their legacy shell scripts. To date
this approach has been very effective (well done to all involved with
Cygwin!) and I have been able make most of the scripts work with only
slight modifications.

However, in the last couple of days a colleague of mine has run into an
issue with a shell script that automates conversion of scanned documents
from TIF to GIF. Sometimes (< 10%) the script does not see the GIF file it
has just created.

We have simulated the structure of the script in this test case:

if test -r test1.dat; then
  echo "File test1.dat already exists"
  # Simulate the image conversion - a short delay then write output file
  sleep 1; touch test1.dat
  if test -r test1.dat; then
    echo "File test1.dat created"
    echo "***ERROR*** Can not create file test1.dat"
if [ $ERROR_FOUND = false ]; then
  # Simulate the submission of a report to run in background
  # Remove the & and the script works!
  sleep 1; echo "OK" &

... and so on for test2.dat, test3.dat, etc.; about 50-100 instances.

Obviously this should not, in normal circumstances, generate the
***ERROR*** message. However, we are finding that it does produce the
message intermittently (< 10%), even though the files are created.

The if statement at the end might look odd but it mimics the running of a
report in background after conversion of the image. This takes a short time
to submit, hence the sleep 1, and runs in the background. Curiously, if we
take the '&' off the echo command (or the report in the real version), the
script works as expected.

We have Cygwin DLL v1.1.7. The script behaves the same on NT4 and Windows
2000. Any ideas? I don't have access to a Linux box here but I will try it
when I get back home tonight -- I am assuming it is only an issue with
Cygwin/Windows. The full test case script can be downloaded from .

I think we can work round the problem but it would be great to have an
answer to maintain the client's confidence in Cygwin.


Richard Senior
Mill Dam Consulting Ltd, London

Want to unsubscribe from this list?
Check out:

More information about the Cygwin mailing list