One race condition.  In practice, it'd come up only if you had two or
more builds at once (which I at least do fairly often), AND if they
chose similar seed random numbers (which should be very unlikely)... but
it's easy to close.


http://gwt-code-reviews.appspot.com/61816/diff/1/2
File
build-tools/ant-gwt/src/com/google/gwt/ant/taskdefs/LatestTimeJar.java
(right):

http://gwt-code-reviews.appspot.com/61816/diff/1/2#newcode163
Line 163: tmpFile.createNewFile();
you need to close the race condition in which "somebody else" makes the
file between line 159 and here... test the return result of
createNewFile(), and loop back up if it failed.

Since any race is probably going to be with something else using this
same algorithm, you might even re-seed if it fails (that is, pick a new
random number).  The actual File.createTempFile() promises never to
reuse the same random file (that is, even if you delete it, you own the
name)... but that assurance doesn't help against competing processes,
either, so I think it's okay not to have the same guarantee here.

http://gwt-code-reviews.appspot.com/61816

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to