From 516780889379cc2b28a4671887f91ab2956e494d Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Mon, 26 Oct 2026 17:09:17 -0700 Subject: [PATCH] Generate revision.h by configure in the build directory (#19545) configure created revision.h in $srcdir when it was missing. Since version.h includes "revision.h", the copy in $srcdir is found before the one in the build directory. This used to be harmless because file2lastrev.rb, run with --srcdir, overwrote that copy in $srcdir on every build. Since 4361d8e48f5 (GH-19367), make writes only ./revision.h via lastrev and ifchange, so the copy in $srcdir was left stale, and every out-of-place build sharing that $srcdir kept embedding the revision at the time of that configure run. --- configure.ac | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index a7d4fa7fc55..054ea8659e4 100644 --- a/configure.ac +++ b/configure.ac @@ -4693,11 +4693,13 @@ AC_SUBST(XCC_WRAPPER) AS_CASE([" $CPP "], [*" $CC "*], [CPP=`echo " $CPP " | sed "s| $CC |"' $(CC) |;s/^ *//;s/ *$//'`]) -AS_IF([test ! -f "$srcdir/revision.h"], [ +# Generate revision.h in the build directory, as make does; one in +# $srcdir would shadow it, since version.h includes "revision.h". +AS_IF([test ! -f "$srcdir/revision.h" -a ! -f revision.h], [ AS_IF([test "x$HAVE_BASERUBY" = xyes], [ - ${BASERUBY} -C "$srcdir" tool/file2lastrev.rb -q --revision.h > "$srcdir/revision.h" + ${BASERUBY} -C "$srcdir" tool/file2lastrev.rb -q --revision.h > revision.h ], [ - touch "$srcdir/revision.h" + touch revision.h ]) ]) @@ -4724,7 +4726,7 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [ AS_CASE("$VCS", ['$(GIT)'|git], [VCSUP='$(VCS) pull --rebase $(GITPULLOPTIONS)'], [VCSUP='$(VCS)']) - for f in "$srcdir/version.h" "$srcdir/revision.h"; do + for f in "$srcdir/version.h" "$srcdir/revision.h" revision.h; do test -f "$f" || continue sed -n \ -e '[/^@%:@define \(RUBY_RELEASE_[A-Z]*\) \([0-9][0-9]*\)/]{' \