File 4332-erts-Remove-ERLANG_COMPILE_DATE-from-erl_version.h.patch of Package erlang

From 384e4a9b078f1c36751d0db8ada5076b5cf2c231 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=B4me=20de=20Bretagne?=
 <jerome.debretagne@gmail.com>
Date: Thu, 6 Jan 2022 23:43:34 +0100
Subject: [PATCH 2/3] erts: Remove ERLANG_COMPILE_DATE from erl_version.h

Do not generate the ERLANG_COMPILE_DATE timestamp in erl_version.h
with the make_version script to ensure reproducible builds.

Remove the corresponding ERTS_SAVED_COMPILE_TIME option and update
the configure scripts accordingly.
---
 erts/config.h.in                      |  3 ---
 erts/configure                        | 19 -------------------
 erts/configure.in                     | 11 +----------
 erts/doc/src/crash_dump.xml           |  3 +--
 erts/emulator/beam/break.c            |  8 +-------
 erts/emulator/beam/erl_init.c         |  3 +--
 erts/emulator/utils/make_version      | 15 +++++----------
 erts/etc/unix/etp-commands.in         | 11 +++++------
 lib/observer/src/crashdump_viewer.erl | 13 +++++++------
 9 files changed, 21 insertions(+), 65 deletions(-)

diff --git a/erts/config.h.in b/erts/config.h.in
index 8eb0d28bf9..8295b90410 100644
--- a/erts/config.h.in
+++ b/erts/config.h.in
@@ -67,9 +67,6 @@
 /* Type qualifier restrict */
 #undef ERTS_RESTRICT
 
-/* Save compile time? */
-#undef ERTS_SAVED_COMPILE_TIME
-
 /* Define if structure alignment is enough for allocators. If not defined,
    64-bit alignment will be forced. */
 #undef ERTS_STRUCTURE_ALIGNED_ALLOC
diff --git a/erts/configure b/erts/configure
index a264407cd2..ec39606d71 100755
--- a/erts/configure
+++ b/erts/configure
@@ -811,7 +811,6 @@ with_dynamic_trace
 enable_vm_probes
 with_assumed_cache_line_size
 enable_systemd
-enable_saved_compile_time
 with_microstate_accounting
 enable_static_nifs
 enable_static_drivers
@@ -4177,24 +4176,6 @@ else
 fi
 
 
-# Check whether --enable-saved-compile-time was given.
-if test "${enable_saved_compile_time+set}" = set; then :
-  enableval=$enable_saved_compile_time;  case "$enableval" in
-    no) save_compile_time=0 ;;
-    *)  save_compile_time=1 ;;
-  esac
-else
-  save_compile_time=1
-fi
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define ERTS_SAVED_COMPILE_TIME $save_compile_time
-_ACEOF
-
-
-
 # Check whether --with-microstate-accounting was given.
 if test "${with_microstate_accounting+set}" = set; then :
   withval=$with_microstate_accounting;
diff --git a/erts/configure.in b/erts/configure.in
index d7828ca14f..beff4275f8 100644
--- a/erts/configure.in
+++ b/erts/configure.in
@@ -294,15 +294,6 @@ AS_HELP_STRING([--enable-systemd], [enable systemd support in epmd]),
 [],
 [enable_systemd=no])
 
-AC_ARG_ENABLE(saved-compile-time,
-AS_HELP_STRING([--disable-saved-compile-time], [disable saved compile time]),
-[ case "$enableval" in
-    no) save_compile_time=0 ;;
-    *)  save_compile_time=1 ;;
-  esac ], save_compile_time=1)
-
-AC_DEFINE_UNQUOTED(ERTS_SAVED_COMPILE_TIME, $save_compile_time, [Save compile time?])
-
 AC_ARG_WITH(microstate-accounting,
 AS_HELP_STRING([--with-microstate-accounting={yes|extra}],
                [enable microstate account, possibly with extra detailed states])
diff --git a/erts/doc/src/crash_dump.xml b/erts/doc/src/crash_dump.xml
index 717fb44b81..4524401473 100644
--- a/erts/doc/src/crash_dump.xml
+++ b/erts/doc/src/crash_dump.xml
@@ -80,7 +80,6 @@
       <item>The creation time for the dump</item>
       <item>A slogan indicating the reason for the dump</item>
       <item>The system version of the node from which the dump originates</item>
-      <item>The compile time of the emulator running the originating node</item>
       <item>The number of atoms in the atom table</item>
       <item>The runtime system thread that caused the crash dump</item>
     </list>
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c
index 8334977160..530dee0746 100644
--- a/erts/emulator/beam/break.c
+++ b/erts/emulator/beam/break.c
@@ -616,9 +616,6 @@ do_break(void)
 	    erts_printf("Erlang (%s) emulator version "
 		       ERLANG_VERSION "\n",
 		       EMULATOR);
-#if ERTS_SAVED_COMPILE_TIME
-	    erts_printf("Compiled on " ERLANG_COMPILE_DATE "\n");
-#endif
 	    return;
 	case 'd':
 	    distribution_info(ERTS_PRINT_STDOUT, NULL);
@@ -928,9 +925,6 @@ erl_crash_dump_v(char *file, int line, const char* fmt, va_list args)
     }
     erts_cbprintf(to, to_arg, "System version: ");
     erts_print_system_version(to, to_arg, NULL);
-#if ERTS_SAVED_COMPILE_TIME
-    erts_cbprintf(to, to_arg, "%s\n", "Compiled: " ERLANG_COMPILE_DATE);
-#endif
 
     erts_cbprintf(to, to_arg, "Taints: ");
     erts_print_nif_taints(to, to_arg);
diff --git a/erts/emulator/beam/erl_init.c b/erts/emulator/beam/erl_init.c
index b7e3d42cfc..ef822dbe8c 100644
--- a/erts/emulator/beam/erl_init.c
+++ b/erts/emulator/beam/erl_init.c
@@ -1,7 +1,7 @@
 /*
  * %CopyrightBegin%
  *
- * Copyright Ericsson AB 1997-2021. All Rights Reserved.
+ * Copyright Ericsson AB 1997-2022. All Rights Reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -74,7 +74,6 @@ const int etp_smp_compiled = 1;
 const int etp_thread_compiled = 1;
 const char etp_erts_version[] = ERLANG_VERSION;
 const char etp_otp_release[] = ERLANG_OTP_RELEASE;
-const char etp_compile_date[] = ERLANG_COMPILE_DATE;
 const char etp_arch[] = ERLANG_ARCHITECTURE;
 #if ERTS_ENABLE_KERNEL_POLL
 const int erts_use_kernel_poll = 1;
diff --git a/erts/emulator/utils/make_version b/erts/emulator/utils/make_version
index e02a42c66d..294520e135 100755
--- a/erts/emulator/utils/make_version
+++ b/erts/emulator/utils/make_version
@@ -1,9 +1,9 @@
-#!/usr/bin/env perl 
+#!/usr/bin/env perl
 #
 # %CopyrightBegin%
-# 
-# Copyright Ericsson AB 1999-2016. All Rights Reserved.
-# 
+#
+# Copyright Ericsson AB 1999-2022. All Rights Reserved.
+#
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
@@ -15,7 +15,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-# 
+#
 # %CopyrightEnd%
 #
 use strict;
@@ -59,11 +59,6 @@ print FILE <<EOF;
 #define ERLANG_OTP_RELEASE "$release"
 #define ERLANG_OTP_VERSION "$otp_version"
 #define ERLANG_VERSION "$version"
-#if ERTS_SAVED_COMPILE_TIME
-#  define ERLANG_COMPILE_DATE "$time_str"
-#else
-#  define ERLANG_COMPILE_DATE ""
-#endif
 #define ERLANG_ARCHITECTURE "$architecture"
 EOF
 
diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in
index fb864c96d9..f63ea8f6ad 100644
--- a/erts/etc/unix/etp-commands.in
+++ b/erts/etc/unix/etp-commands.in
@@ -15,13 +15,13 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-# 
+#
 # %CopyrightEnd%
 #
 
 ############################################################################
 # Help commands
-# 
+#
 
 define etp-help
   help etp-help
@@ -3395,7 +3395,6 @@ define etp-system-info
   printf "--------------- System Information ---------------\n"
   printf "OTP release: %s\n", etp_otp_release
   printf "ERTS version: %s\n", etp_erts_version
-  printf "Compile date: %s\n", etp_compile_date
   printf "Arch: %s\n", etp_arch
   printf "Endianness: "
   if (etp_endianness > 0)
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index 71df6fd4b0..b876ce2945 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -14,15 +14,15 @@
 %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 %% See the License for the specific language governing permissions and
 %% limitations under the License.
-%% 
+%%
 %% %CopyrightEnd%
 %%
 -module(crashdump_viewer).
 
-%% 
+%%
 %% This module is the main module in the crashdump viewer. It implements
 %% the server backend for the crashdump viewer tool.
-%% 
+%%
 %% Tables
 %% ------
 %% cdv_dump_index_table: This table holds all tags read from the
@@ -1084,6 +1084,7 @@ get_slogan_and_sysvsn(Fd,Acc) ->
 
 get_general_info(Fd,GenInfo) ->
     case line_head(Fd) of
+        %% The compile time info was generated in older crash dump versions
 	"Compiled" ->
 	    get_general_info(Fd,GenInfo#general_info{compile_time=bytes(Fd)});
 	"Taints" ->
-- 
2.31.1

openSUSE Build Service is sponsored by