Feature #2828

Reproducible builds

Added by stbuehler almost 3 years ago. Updated almost 3 years ago.

Target version:


Using __DATE__ and __TIME__ macros in C leads to non-reproducible builds (goal: create the exact same files when run in the same environment again).

lighttpd.spec shows how opensuse patches the sources to replace those macros with a timestamp from their changelog.

I would be nice to offer a cleaner API here (or maybe simply (optionally) remove the timestamp completely).

Otoh it seems more recent gcc versions might support SOURCE_DATE_EPOCH.


Updated by gstrauss almost 3 years ago

In lighttpd's case, I'd be fine with removing DATE and TIME from server.c, where this info is used only for display when showing version (lighttpd -v) or showing help (lighttpd -h) For most people, installing the package would already have package build info in package database. For those building from source, the timestamps on the lighttpd executable would probably suffice for "when was this built?" as long as timestamp was preserved when installed out of the build area.

FYI: I wrote a multi-platform set of macros that stores ident information in the .comment section of the binary, instead of in .data.
This separate section could be separated from the binary after the build and stored separately in a database, keyed by a checksum of the binary after the .comment section has been removed.


Updated by gstrauss almost 3 years ago

--- a/src/server.c
+++ b/src/server.c
@@ -538,8 +538,10 @@ static int server_oneshot_init(server *srv, int fd) {

 static void show_version (void) {
        char *b = PACKAGE_DESC TEXT_SSL \
-" - a light and fast webserver\n" \
+" - a light and fast webserver\n" 
 "Build-Date: " __DATE__ " " __TIME__ "\n";
        write_all(STDOUT_FILENO, b, strlen(b));
@@ -705,7 +707,10 @@ static void show_features (void) {

 static void show_help (void) {
-       char *b = PACKAGE_DESC TEXT_SSL " ("__DATE__ " " __TIME__ ")" \
+       char *b = PACKAGE_DESC TEXT_SSL
+" ("__DATE__ " " __TIME__ ")" 
 " - a light and fast webserver\n" \
 "usage:\n" \
 " -f <name>  filename of the config-file\n" \

Updated by gstrauss almost 3 years ago

  • Category set to core
  • Status changed from New to Patch Pending
  • Target version changed from 1.4.x to 1.4.46

Updated by gstrauss almost 3 years ago

  • Status changed from Patch Pending to Fixed
  • % Done changed from 0 to 100

Also available in: Atom