[getdns-users] [PATCH] remove GETDNS_COMPILATION_COMMENT

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Jul 8 17:51:41 UTC 2015


It's not clear that GETDNS_COMPILATION_COMMENT is useful; as a header
(a #define), it's likely to get embedded in applications during their
build time.  It is not embedded in the library itself at all, so
removal of it doesn't change the ABI (there is a slight change in the
API because the #define is no longer visible in getdns.h, but i think
this is OK, see below).

When a built application that uses GETDNS_COMPILATION_COMMENT is
executed, linked against a different version of the library it was
built from, there is no way to detect that these values differ.  How
is it useful at runtime?

The #define also introduces arbitrariness in the getdns build process
when --with-current-date isn't supplied, because it embeds the current
timestamp in getdns.h.  This makes it more difficult to build a
byte-for-byte reproducible binary package.

http://codesearch.debian.net/results/GETDNS_COMPILATION_COMMENT
indicates that there are no projects in debian actually using the
defined variable (there may be non-debian projects that use it, though
it's not clear how it is expected to be used at runtime at all).

Removing this #define removes a source of confusion for users of the
project, and doesn't change the ABI.
---
 ChangeLog              |  1 +
 configure              | 15 ---------------
 configure.ac           |  9 ---------
 spec/index.html        |  5 -----
 src/getdns/getdns.h.in |  2 --
 5 files changed, 1 insertion(+), 31 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a70879d..438c1b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,7 @@
     GETDNS_TRANSPORT_STARTTLS.
   * Added new context setting for idle_timeout
   * CSYNC RR type
+  * remove GETDNS_COMPILATION_COMMENT, CURRENT_DATE, and --with-current-date
 
 * 2015-05-21: Version 0.2.0
   * Fix libversion numbering:  Thanks Daniel Kahn Gillmor
diff --git a/configure b/configure
index c86c59f..9e01aab 100755
--- a/configure
+++ b/configure
@@ -706,7 +706,6 @@ LDFLAGS
 CFLAGS
 CC
 GETDNS_LIBVERSION
-GETDNS_COMPILATION_COMMENT
 RELEASE_CANDIDATE
 target_alias
 host_alias
@@ -749,7 +748,6 @@ SHELL'
 ac_subst_files=''
 ac_user_opts='
 enable_option_checking
-with_current_date
 enable_shared
 enable_static
 with_pic
@@ -1420,8 +1418,6 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-current-date
-    current date of the compilation, set to fixed date for reproducible builds [default=system]
 
   --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                           both]
@@ -2371,17 +2367,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-# Set current date from system if not set
-
-# Check whether --with-current-date was given.
-if test "${with_current_date+set}" = set; then :
-  withval=$with_current_date; CURRENT_DATE="$with_current_date"
-else
-  CURRENT_DATE="`date -u +%Y-%m-%dT%H:%M:%SZ`"
-fi
-
-GETDNS_COMPILATION_COMMENT="getdns 0.2.0 configured on $CURRENT_DATE for the January 2015 version of the API"
-
 # Library version
 # ---------------
 # current:revision:age
diff --git a/configure.ac b/configure.ac
index 48bb399..ef060ea 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,14 +34,6 @@ AC_PREREQ([2.56])
 AC_INIT([getdns], [0.2.0], [stub-resolver at verisignlabs.com], [], [http://getdnsapi.net])
 AC_SUBST(RELEASE_CANDIDATE, [])
 
-# Set current date from system if not set
-AC_ARG_WITH([current-date],
-  [AS_HELP_STRING([--with-current-date]
-    [current date of the compilation, set to fixed date for reproducible builds @<:@default=system@:>@])],
-  [CURRENT_DATE="$with_current_date"],
-  [CURRENT_DATE="`date -u +%Y-%m-%dT%H:%M:%SZ`"])
-GETDNS_COMPILATION_COMMENT="AC_PACKAGE_STRING configured on $CURRENT_DATE for the January 2015 version of the API"
-
 # Library version
 # ---------------
 # current:revision:age
@@ -62,7 +54,6 @@ GETDNS_COMPILATION_COMMENT="AC_PACKAGE_STRING configured on $CURRENT_DATE for th
 #
 GETDNS_LIBVERSION=2:2:1
 
-AC_SUBST(GETDNS_COMPILATION_COMMENT)
 AC_SUBST(GETDNS_LIBVERSION)
 AC_CONFIG_SRCDIR([src/getdns/getdns.h.in])
 # AM_INIT_AUTOMAKE
diff --git a/spec/index.html b/spec/index.html
index a98e37c..a6dd53a 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -2521,11 +2521,6 @@ of this API must support synchronous calls with <code>getdns_general_sync()</cod
 this API is "getdns April 2013". Each implementation is free to set the implementation string as it
 feels fit.</p>
 
-<p>The API's .h file contains a macro called <code>GETDNS_COMPILATION_COMMENT</code>. This can be useful
-to an application which will use the API because it can check the string without calling any
-functions. Each time the API implementation is compiled, this string should be updated with unique
-information about the implementation build.</p>
-
 <p>The implementation of both the async and sync <code>getdns</code> functions will
 copy all the values of the parameters into local memory, in case the application changes or
 deallocates them.</p>
diff --git a/src/getdns/getdns.h.in b/src/getdns/getdns.h.in
index 3f133a4..133d9cb 100644
--- a/src/getdns/getdns.h.in
+++ b/src/getdns/getdns.h.in
@@ -44,8 +44,6 @@
 extern "C" {
 #endif
 
-#define GETDNS_COMPILATION_COMMENT "@GETDNS_COMPILATION_COMMENT@"
-
 /* Return values */
 typedef enum getdns_return_t {
 	GETDNS_RETURN_GOOD = 0,
-- 
2.1.4




More information about the Users mailing list