From patchwork Tue Mar 8 17:06:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aurelien Jarno X-Patchwork-Id: 11274 Received: (qmail 49756 invoked by alias); 8 Mar 2016 17:06:47 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 49729 invoked by uid 89); 8 Mar 2016 17:06:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.8 required=5.0 tests=BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=U*aurelien, sk:aurelie, aurelien@aurel32.net, D*aurel32.net X-HELO: hall.aurel32.net From: Aurelien Jarno To: libc-alpha@sourceware.org Cc: Aurelien Jarno Subject: [PATCH] nscd_stat.c: make the build reproducible Date: Tue, 8 Mar 2016 18:06:31 +0100 Message-Id: <1457456791-17402-1-git-send-email-aurelien@aurel32.net> nscd_stat.c uses the __DATE__ and __TIME__ macros to make sure the client and the server use the same format. This prevents reproducible builds and fails to build with -Werror=date-time. In addition another build of the same file a bit later does not necessary imply a change in the format. Instead compute a checksum of the file in the Makefile and pass it to the preprocessor with the -D option. Use the md5sum command limited to 20 characters to avoid changing the structure size. Changelog: * math/nscd (CPPFLAGS-nscd_stat.c): Append -DNSCD_STAT_C_CHECKSUM=... with the checksum of nscd_stat.c computed with md5sum. * nscd/nscd_stat.c (compilation): Use NSCD_STAT_C_CHECKSUM instead of __DATE__ " " __TIME__. --- ChangeLog | 7 +++++++ nscd/Makefile | 4 ++++ nscd/nscd_stat.c | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 289d578..8f0b24f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-03-08 Aurelien Jarno + + * math/nscd (CPPFLAGS-nscd_stat.c): Append -DNSCD_STAT_C_CHECKSUM=... + with the checksum of nscd_stat.c computed with md5sum. + * nscd/nscd_stat.c (compilation): Use NSCD_STAT_C_CHECKSUM instead of + __DATE__ " " __TIME__. + 2016-03-08 H.J. Lu [BZ #19783] diff --git a/nscd/Makefile b/nscd/Makefile index 50bad32..2678c6b 100644 --- a/nscd/Makefile +++ b/nscd/Makefile @@ -90,6 +90,10 @@ ifeq (yesyes,$(have-fpie)$(build-shared)) LDFLAGS-nscd = -Wl,-z,now endif +# Compute a checksum of the file to verify that the sender and the +# receiver are using the same format. +CPPFLAGS-nscd_stat.c += -DNSCD_STAT_C_CHECKSUM='"$(shell md5sum $< | cut -c1-20)"' + # Set libof-nscd. cpp-srcs-left := $(nscd-modules) lib := nscd diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c index f34c352..fa294ca 100644 --- a/nscd/nscd_stat.c +++ b/nscd/nscd_stat.c @@ -37,7 +37,7 @@ /* We use this to make sure the receiver is the same. */ -static const char compilation[21] = __DATE__ " " __TIME__; +static const char compilation[21] = NSCD_STAT_C_CHECKSUM; /* Statistic data for one database. */ struct dbstat