Comment 2 for bug 1749320

Revision history for this message
John A Meinel (jameinel) wrote :

I'm able to reproduce this with this patch:
+(/bin/sleep 2 ; export) | grep -v $FILTER > $JUJU_DEBUG/env.sh

for some reason I don't understand:
(sleep 2; export)

*doesn't* trigger this, but /bin/sleep does.

I think the underlying race condition is that

blah > target

will create 'target' as soon as that line starts, but nothing actually gets written until 'blah' exits.

However, the test as written assumes that as soon as "stat env.sh" succeeds, that it can then read the contents of env.sh.
We either want a loop that checks to see if env.sh is empty, or write to a temp file and rename into place.