Jakub Jelinek <ja...@redhat.com> writes:

> On Tue, Jan 10, 2023 at 11:16:28AM +0100, Richard Biener via Gcc-patches 
> wrote:
>> > @@ -424,7 +388,7 @@ override PLUGINCFLAGS := $(filter-out 
>> > -mdynamic-no-pic,$(PLUGINCFLAGS))
>> >
>> >  plugin/m2rte$(soext): $(srcdir)/m2/plugin/m2rte.cc 
>> > $(GCC_HEADER_DEPENDENCIES_FOR_M2) \
>> >          insn-attr-common.h insn-flags.h $(generated_files)
>> > -       test -d plugin || mkdir plugin
>> > +       -test -d plugin || $(mkinstalldirs) plugin
>> 
>> I wonder if that's possibly racy (that's why you use mkinstalldirs?)?
>
> Using $(mkinstalldirs) in the patch is what I've suggested because
> previously the patch was using mkdir -p which we almost never use
> (I think only some Ada Makefiles).  Above when it is a single directory
> mkdir is fine.
>       -test -d $(TESTSUITEDIR) || mkdir $(TESTSUITEDIR)
> etc. is what is used in gcc/Makefile.in in some spots.
> If 2 shells do that test -d plugin || mkdir plugin at the same time,
> then yes, both might do mkdir, but that is why we have the - at the start,
> the error of doing mkdir twice will be ignored then.

thanks both - will apply the patch and close the PR

regards,
Gaius

Reply via email to