Build failure: install race condition
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 36k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với Makefile được cung cấp và make -j2, sau đó kiểm tra các quy tắc cài đặt được tạo ra cho commoninstall, altbininstall và libinstall. Bản sửa lỗi được hoàn tất khi make install song song không còn xảy ra race condition trong lúc tạo các thư mục dùng chung, kể cả với GNU Make 4.4 trên Python 3.11.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- build-system
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100