Skip to contentSkip to conversation

Make build deterministic, remove __DATE__

PATCH In review Frank Lichtenheld 4 participants 10 messages Dec 13, 2021 – Aug 8, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make build deterministic, remove __DATE__

The information provided by this is minimal and it makes it more difficult to provide deterministic builds. There are work-arounds for that but I think it is easier to just remove it completely.

Allows the build to pass with -Wdate-time -Werror.

---
 src/openvpn/options.c | 1 -
 src/tapctl/main.c     | 1 -
 2 files changed, 2 deletions(-)
src/openvpn/options.c +0 -1
index ac13412a..79f453d4 100644
@@ -105,7 +105,6 @@ const char title_string[] =
 #endif
 #endif
     " [AEAD]"
-    " built on " __DATE__
 ;
 
 #ifndef ENABLE_SMALL
src/tapctl/main.c +0 -1
index a3d3966a..d60df275 100644
@@ -44,7 +44,6 @@
 
 const TCHAR title_string[] =
     TEXT(PACKAGE_NAME) TEXT(" ") TEXT(PACKAGE_VERSION)
-    TEXT(" built on ") TEXT(__DATE__)
 ;
 
 static const TCHAR usage_message[] =
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw

Am 13.12.21 um 17:28 schrieb Frank Lichtenheld:

Quoted 6 lines

The information provided by this is minimal and it makes it more difficult to provide deterministic builds. There are work-arounds for that but I think it is easier to just remove it completely.

Acked-by on v1 1/1
#2 lore raw
In reply to Frank Lichtenheld

Hi,

Quoted 9 lines · Frank Lichtenheld

The information provided by this is minimal and it makes it more difficult to provide deterministic builds. There are work-arounds for that but I think it is easier to just remove it completely.

Allows the build to pass with -Wdate-time -Werror.

Signature · 1 line
Antonio Quartulli
#3 lore raw
In reply to Frank Lichtenheld

Hi,

Quoted 9 lines · Frank Lichtenheld

The information provided by this is minimal and it makes it more difficult to provide deterministic builds. There are work-arounds for that but I think it is easier to just remove it completely.

Allows the build to pass with -Wdate-time -Werror.

I see that this patch has two ACKs, but I feel I'd lose visibility into my heap of test binaries all over the place.

OTOH, I do see the argument about deterministic (release) builds.

What we already do today is to include the git commit ID *iff* this is built from git into CONFIGURE_GIT_REVISION (version.h) - maybe this could be done in a similar way?

- if there is no .git around (and/or $condition?), build without commit ID and no build date

- if there is, add build date + git revision to "openvpn --version"

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
#4 lore raw

PATCH 1/2 config-version.h: remove unused includes

We only need to include this when we want the
git version. This is currently only the case
in options.c

---
 src/openvpn/block_dns.c | 3 ---
 src/openvpn/plugin.c    | 3 ---
 src/tapctl/main.c       | 3 ---
 3 files changed, 9 deletions(-)
src/openvpn/block_dns.c +0 -3
index 88e933fb..7849ec53 100644
@@ -28,9 +28,6 @@
 #elif defined(_MSC_VER)
 #include "config-msvc.h"
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include "config-version.h"
-#endif
 
 #include "syshead.h"
 
src/openvpn/plugin.c +0 -3
index 51136fea..dc7fd459 100644
@@ -26,9 +26,6 @@
 #elif defined(_MSC_VER)
 #include "config-msvc.h"
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include "config-version.h"
-#endif
 
 #include "syshead.h"
 
src/tapctl/main.c +0 -3
index df73a965..e13549bf 100644
@@ -24,9 +24,6 @@
 #elif defined(_MSC_VER)
 #include <config-msvc.h>
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include <config-version.h>
-#endif
 
 #include "tap.h"
 #include "error.h"
Signature · 1 line
2.34.1
#5 lore raw

PATCH 2/2 Reduce usage of __DATE__

To increase the reproducibility of builds we shouldn't use __DATE__. However, for the development builds there is some demand for leaving this in.

So as suggested by Gert Doering go for a compromise where we only use __DATE__ if we also include the git information. This will remove this information from release builds, but not from builds done directly from the git checkout.

---
 src/openvpn/options.c | 2 ++
 src/tapctl/main.c     | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
src/openvpn/options.c +2 -0
index 3eae14a7..0ce3158b 100644
@@ -110,7 +110,9 @@ const char title_string[] =
 #ifdef ENABLE_DCO
     " [DCO]"
 #endif
+#ifdef CONFIGURE_GIT_REVISION
     " built on " __DATE__
+#endif
 ;
 
 #ifndef ENABLE_SMALL
src/tapctl/main.c +0 -1
index e13549bf..0724cc4d 100644
@@ -41,7 +41,6 @@
 
 const TCHAR title_string[] =
     TEXT(PACKAGE_NAME) TEXT(" ") TEXT(PACKAGE_VERSION)
-    TEXT(" built on ") TEXT(__DATE__)
 ;
 
 static const TCHAR usage_message[] =
Signature · 1 line
2.34.1
#7 lore raw

Re: [Openvpn-devel] [PATCH 1/2] config-version.h: remove unused includes

In reply to Frank Lichtenheld

Hi,

Quoted 3 lines · Frank Lichtenheld

We only need to include this when we want the
git version. This is currently only the case
in options.c

Feature-ACK, but NAK on this hunk:

src/openvpn/plugin.c line 31

Quoted 11 lines
src/openvpn/plugin.c +0 -3
index 51136fea..dc7fd459 100644
@@ -26,9 +26,6 @@
 #elif defined(_MSC_VER)
 #include "config-msvc.h"
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include "config-version.h"
-#endif

plugin.c actually uses CONFIGURE_GIT_REVISION for the openvpn version visible to plugins

#ifndef CONFIGURE_GIT_REVISION
#define _OPENVPN_PATCH_LEVEL OPENVPN_VERSION_PATCH
#else
#define _OPENVPN_PATCH_LEVEL "git:" CONFIGURE_GIT_REVISION CONFIGURE_GIT_FLAGS #endif
...

            struct openvpn_plugin_args_open_in args = { p->plugin_type_mask,
...
                                                        _OPENVPN_PATCH_LEVEL};

The other two (block_dns.c and tapctl.c) can go.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...
Acked-by on v1 2/2
#6 lore raw

[Openvpn-devel] [PATCH applied] Re: Reduce usage of __DATE__

In reply to Frank Lichtenheld

I think this is a workable compromise - thanks.

Building from git gives me

OpenVPN 2.6_git [git:master/a9b3585d606e5b57] x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD] [DCO] built on Aug 6 2022

doing a "make dist" and building from the resulting tarball gives

OpenVPN 2.6_git x86_64-pc-linux-gnu [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [MH/PKTINFO] [AEAD]

Your patch has been applied to the master branch.

commit a9b3585d606e5b5717778777a4f346c8371d2698

Author: Frank Lichtenheld
Date:   Thu Aug 4 17:03:01 2022 +0200
     Reduce usage of __DATE__

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24807.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#8 lore raw

PATCH v2 1/2 config-version.h: remove unused includes

In reply to Frank Lichtenheld

We only need to include this when we want the
git version.

---
 src/openvpn/block_dns.c | 3 ---
 src/tapctl/main.c       | 3 ---
 2 files changed, 6 deletions(-)

v2: Do not remove include in plugin.c

src/openvpn/block_dns.c +0 -3
index 88e933fb..7849ec53 100644
@@ -28,9 +28,6 @@
 #elif defined(_MSC_VER)
 #include "config-msvc.h"
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include "config-version.h"
-#endif
 
 #include "syshead.h"
 
src/tapctl/main.c +0 -3
index a98cc6a8..0724cc4d 100644
@@ -24,9 +24,6 @@
 #elif defined(_MSC_VER)
 #include <config-msvc.h>
 #endif
-#ifdef HAVE_CONFIG_VERSION_H
-#include <config-version.h>
-#endif
 
 #include "tap.h"
 #include "error.h"
Signature · 1 line
2.34.1
Acked-by on v2 1/2
#9 lore raw

[Openvpn-devel] [PATCH applied] Re: config-version.h: remove unused includes

Test compiled on ubuntu18/mingw.

Your patch has been applied to the master branch.

commit d92075e0ae6dba84a2e30e4ec12ca29250945371

Author: Frank Lichtenheld
Date:   Mon Aug 8 10:54:11 2022 +0200
     config-version.h: remove unused includes

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg24839.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering