URL: <https://savannah.gnu.org/bugs/?60960>
Summary: Fix/report race problem if having multiple "alias" for the same target Project: make Submitted by: None Submitted on: Thu 22 Jul 2021 01:49:14 PM UTC Severity: 3 - Normal Item Group: Enhancement Status: None Privacy: Public Assigned to: None Open/Closed: Open Discussion Lock: Any Component Version: 4.2.1 Operating System: None Fixed Release: None Triage Status: None _______________________________________________________ Details: Our team faced some race problems while building a project with Make. Precise analysis shows that the problem was in fact, that Make doesn't care if we have different aliases for the same target. For example: ``` .PHONY: all ../1/../main.o ../2/../main.o all: ../1/../main.o ../2/../main.o ../1/../main.o: ccache gcc -o $@ -c ../main.c ../2/../main.o: ccache gcc -o $@ -c ../main.c ``` Here, we have 2 targets: ../1/../main.o ../2/../main.o In fact, this is the same target/file (taking into account relative directories). As a result if Make will create several threads (for each target) main.o file will be written concurrently (race condition). Make doesn't operate in a wrong way. Anyway, I think it would be great to have an additional checker in a Makefile which (at least) will notify the operator about the problem in a Makefile. P.S. Makefile project, using which it is possible to reproduce the problem is attached to this ticket. _______________________________________________________ File Attachments: ------------------------------------------------------- Date: Thu 22 Jul 2021 01:49:14 PM UTC Name: build_race.tar Size: 20KiB By: None <http://savannah.gnu.org/bugs/download.php?file_id=51680> _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?60960> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/