One problem with this is that you're replacing this pattern rm -r $DIR mkdir -p $DIR with this: mkdir -p $DIR rm -r $DIR/*
However, they are not equivalent. :( The latter will not remove any hidden dot-files. I recommend that you create a new macro like MakeAndCleanDir, which does this, and that it either keeps the old behavior of always removing the dir recursively and then re-create it, or that your create it conditionally like now but fix so rm also handles dot-files. Or that it checks if any files are present by $(wildcard) and only calls rm if needed. This is likely most efficient, but care must be taken to be sure to check for dot files, but not for the . or .. dirs. /Magnus > 5 okt. 2018 kl. 23:31 skrev Erik Joelsson <erik.joels...@oracle.com>: > > As a followup to JDK-8211677, here is an attempt at fixing most other > instances of $(MKDIR) -p to instead of the MakeDir or MakeTargetDir macros. > Since fixing the previous bug, we have hit the race in other recipes as well > so this is really needed. > > There are some situations where the macro would not apply, so those have been > skipped. I'm also pretty sure that those are race free. See bug comment for > details. > > In addition to this I evaluated the AC_PROG_MKDIR_P macro. It didn't quite > work out for us however. The fallback method if it cannot find a suitable > mkdir binary is to use the build-aux/install.sh script. Our problem is that > we have not included this script in our source (just a fake empty file) and > to include it now would require a lot of legal work. What I've done instead > is to simply add gmkdir first in the list of programs to look for when > searching for mkdir. On Solaris, this is the program the macro found (and > internally we have that installed on Solaris), so this will at least fix the > immediate problem we are currently facing. > > Bug: https://bugs.openjdk.java.net/browse/JDK-8211724 > > Webrev: http://cr.openjdk.java.net/~erikj/8211724/webrev.01/index.html > > /Erik >