Build failure: install race condition
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 77.2k
- Forks
- 36k
- Métricas de merge de PRs
- Métricas de PR pendentes
Descrição
Bug report
The generated Makefile for Python 3.11 has a race condition in its install target.
So far it triggers easiest with GNU Make 4.4 (I think they distribute more tasks breadth first instead of depth first compared to v4.3)
In short, this is a reproducer of the problem:
LIBDIR := $(CURDIR)/lib
INSTALL := /usr/bin/install -c
all: a b
a b:
@for i in $(LIBDIR); do \
if test ! -d $$i; then \
echo "Creating directory $$i"; \
$(INSTALL) -d -m 755 $$i; \
else true; \
fi \
done
causing a race as follows:
% make -j2
Creating directory /private/var/folders/33/7njsb0_50dl7hnkr58nbnpb00000gn/T/tmp.TOdJ6wpw/lib
Creating directory /private/var/folders/33/7njsb0_50dl7hnkr58nbnpb00000gn/T/tmp.TOdJ6wpw/lib
install: mkdir /private/var/folders/33/7njsb0_50dl7hnkr58nbnpb00000gn/T/tmp.TOdJ6wpw/lib: File exists
make: *** [a] Error 71
This happens exactly in Python during make install -j$(nproc) as the commoninstall target has the prereqs altbininstall libinstall (among others) which both have a shell script loop over some directories they wanna make, and in particular it has:
altbininstall: $(BUILDPYTHON)
@for i in $(BINDIR) $(LIBDIR); \
... like example above (if dir not exists, run install)
libinstall: all $(srcdir)/Modules/xxmodule.c
@for i in $(SCRIPTDIR) $(LIBDEST); \
... like example above (if dir not exists, run install)
where SCRIPTDIR and LIBDIR in my case both point to <prefix>/lib.
Your environment
Python 3.11
GNU Make 4.4
macOS Ventura M1
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
Comece reproduzindo a falha com o Makefile fornecido e make -j2; em seguida, inspecione as regras de instalação geradas para commoninstall, altbininstall e libinstall. A correção estará concluída quando o make install paralelo não apresentar mais condições de corrida ao criar diretórios compartilhados, inclusive com GNU Make 4.4 no Python 3.11.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- python
- Domínio
- build-system
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 45/100