'g.region -p' writes new WIND file, causes race condition for parallel jobs
In tracking down some strangeness I've just noticed that 'g.region -p' or 'g.region -g' writes out a new (unchanged) WIND file whenever it runs.
This is a problem when you have many jobs working in parallel and a bunch of them starting at the same time all call 'eval
g.region -g' at the start of their scripts. About 5% of the time I'm hitting the file before it is completely written and the unfortunate g.region G_fatal_error()s with a missing projection parameter or similar.
one solution is to not open the WIND file for writing if just read-only command line terms are given, another is to write to a .tmp file and move it into place atomically.