race condition due to install-file macro ?

David Holmes david.holmes at oracle.com
Wed Jan 2 23:05:07 PST 2013


Given:

$(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
	$(CD) $(@D)&& $(TOOL_BUILDMETAINDEX) -o meta-index `$(LS) *.jar | 
$(SED) 's/JObjC\.jar//g'`

where the JRE_LIB_TARGETS all involve copying a file from the build 
output directory to the correct images directory ... a given jar file 
will appear in the images directory once the copy commences. Can it be 
that make will see the existence of that file as indicating a 
satisfactory meeting of the prerequisite and commence the recipe for 
creating the meta-index thus allowing the indexing tool to start working 
on a jar file that is still in the process of being copied?

I don't know in detail how the parallel aspects of make really work.

It may be that the install-file macro needs to copy to a tmp name and 
then rename to the final name once the cp is complete.

I haven't encountered this myself but others experimenting with the 
Profiles builds have run into an error from the indexing tool indicating 
a jar file could not be opened/read - which is explainable if the file 
was still being copied.

Thoughts?

David



More information about the build-infra-dev mailing list