Source: php8.2
Severity: normal
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: timestamps
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org, Jelle van der Waa 
<je...@vdwaa.nl>

Somehow the build time affects or is embedded in the generation of
/usr/bin/phar*.phar:

  
https://tests.reproducible-builds.org/debian/rb-pkg/bookworm/amd64/diffoscope-results/php8.2.html

The attached patch fixes this by setting the timestamp embedded to "0".

I have not tested that the resulting phar8.2.phar functions correctly,
but it does build, so it would be good for someone who knows how to use
phar to test that before applying!

According to my local tests, with this patch applied (and the one for
usrmerge) php8.2 should become reproducible once it transitions to
bookworm/testing!

Other outstanding issues (e.g. build paths) which are tested only on
unstable and experimental, and still need further investigation.

Thanks for maintaining php8.2!

live well,
  vagrant
From 743402aceee59da001af1e522290cda561111484 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <vagr...@reproducible-builds.org>
Date: Tue, 25 Apr 2023 11:20:24 -0700
Subject: [PATCH 4/6] Remove timestamps from "phar".

Thanks to Jelle van der Waa!

https://gist.github.com/jelly/96847934239aac19c512c54ca65d6baa
---
 ext/phar/phar.c | 2 +-
 ext/phar/util.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index f60b0d6a..12cc7b63 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -2999,7 +2999,7 @@ int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int conv
 			4: metadata-len
 			+: metadata
 		*/
-		mytime = time(NULL);
+		mytime = 0;
 		phar_set_32(entry_buffer, entry->uncompressed_filesize);
 		phar_set_32(entry_buffer+4, mytime);
 		phar_set_32(entry_buffer+8, entry->compressed_filesize);
diff --git a/ext/phar/util.c b/ext/phar/util.c
index 72e633a5..d126d392 100644
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -574,7 +574,7 @@ phar_entry_data *phar_get_or_create_entry_data(char *fname, size_t fname_len, ch
 
 	phar_add_virtual_dirs(phar, path, path_len);
 	etemp.is_modified = 1;
-	etemp.timestamp = time(0);
+	etemp.timestamp = 0;
 	etemp.is_crc_checked = 1;
 	etemp.phar = phar;
 	etemp.filename = estrndup(path, path_len);
-- 
2.39.2

Attachment: signature.asc
Description: PGP signature

Reply via email to