NetBSD Problem Report #52443

From  Sun Jul 30 14:47:19 2017
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (verified OK))
	by (Postfix) with ESMTPS id DD9377A172
	for <>; Sun, 30 Jul 2017 14:47:19 +0000 (UTC)
Message-Id: <>
Date: Sun, 30 Jul 2017 14:47:00 +0000 (UTC)
Subject: Reproducible builds don't work on 64bit Linux
X-Send-Pr-Version: www-1.0

>Number:         52443
>Category:       toolchain
>Synopsis:       Reproducible builds don't work on 64bit Linux
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 30 14:50:00 +0000 2017
>Originator:     Aymeric Vincent
>Release:        -current, -8
Linux 4.12.4 x86_64

Option "-P" (reproducible builds) of src/ is broken on Linux.

usr.bin/cvslatest/cvslatest.c makes use of strptime(3), but strptime() requires _XOPEN_SOURCE to be defined under Linux in order to get its prototype.

However, given that the code for the function is in libc anyway, strptime() will be called and treated as if it returned an int when it actually returns a pointer. The pointer is truncated to 32bits, dereferenced, and nbcvslatest dumps core.

A much less important problem is also that the timestamp is printed by src/ at the end of the build, using "date -r" which doesn't do the same thing at all. "date -d @TS" works on both NetBSD and Linux, but from looking at the date(1) man page of FreeBSD it shouldn't work on FreeBSD.


Try to -P under a 64bit Linux. See it fail and make nbcvslatest dump core.

It is also probably broken on any non-NetBSD LP64 OS which has strict feature testing header files.

A workaround for the problem is to


at the beginning of usr.bin/cvslatest/cvslatest.c, but it looks wrong because it makes less OS independant. Possibly a better solution would be to import strptime.c into src/tools/compat.

As for the timestamp printing problem, it could make sense to check which OS we are running on to select an invocation of date. A simpler solution would be to print the timestamp untouched, as a number of seconds since Epoch.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD:,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.