Describe the bug
When Erlang/OTP is built from a git checkout with GNU Make 4.4 or later, the
emulator version banner reports [source] instead of [source-<sha>]:
# built with GNU Make 4.4.1
Erlang/OTP 29 [erts-17.0.4] [source] [64-bit] [smp:96:96] ...
# same tree, built with GNU Make 4.3
Erlang/OTP 29 [erts-17.0.4] [source-b8b61f0d2a] [64-bit] [smp:96:96] ...
erlang:system_info(system_version) is affected identically, so build
provenance is silently lost for anyone shipping VMs built from source.
The build does not fail and emits no warning. -include is silent by design,
and because the generator script never executes, git is never invoked — so
there is no git error in any build log either.
Root cause
erts/emulator/Makefile.in derives the revision by declaring an -include'd
makefile .PHONY, so that make's makefile-remaking pass regenerates it on every
build (line numbers from master @ 54f3d55ee9):
:26 -include $(TARGET)/gen_git_version.mk
:285 CFLAGS = ... $(GIT_VSN)
:1470 .PHONY: $(TARGET)/gen_git_version.mk
:1471 $(TARGET)/gen_git_version.mk:
:1474 $(V_at)if utils/gen_git_version $@; then touch beam/erl_bif_info.c; fi
GNU Make 4.4 no longer remakes makefiles that are declared .PHONY. The recipe
never runs, $(TARGET)/gen_git_version.mk is never written, GIT_VSN stays
empty, ERLANG_GIT_VERSION is never defined, and
erts/emulator/beam/erl_bif_info.c:96-100 falls through to the #else branch.
To Reproduce
No OTP checkout required. Four lines:
all: ; @echo DEFAULT-GOAL-RAN
-include foo.mk
.PHONY: foo.mk
foo.mk: ; @echo REMAKE-PASS-RAN
- GNU Make 4.3 prints both lines.
- GNU Make 4.4.1 prints only
DEFAULT-GOAL-RAN.
Expected behavior
populate sha when build from git repo.
Describe the bug
When Erlang/OTP is built from a git checkout with GNU Make 4.4 or later, the
emulator version banner reports
[source]instead of[source-<sha>]:erlang:system_info(system_version)is affected identically, so buildprovenance is silently lost for anyone shipping VMs built from source.
The build does not fail and emits no warning.
-includeis silent by design,and because the generator script never executes,
gitis never invoked — sothere is no git error in any build log either.
Root cause
erts/emulator/Makefile.inderives the revision by declaring an-include'dmakefile
.PHONY, so that make's makefile-remaking pass regenerates it on everybuild (line numbers from
master@54f3d55ee9):GNU Make 4.4 no longer remakes makefiles that are declared
.PHONY. The recipenever runs,
$(TARGET)/gen_git_version.mkis never written,GIT_VSNstaysempty,
ERLANG_GIT_VERSIONis never defined, anderts/emulator/beam/erl_bif_info.c:96-100falls through to the#elsebranch.To Reproduce
No OTP checkout required. Four lines:
DEFAULT-GOAL-RAN.Expected behavior
populate sha when build from git repo.