Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 63 additions & 24 deletions deps-packaging/php/0002-Honor-SOURCE_DATE_EPOCH-in-phar.patch
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Lars Erik Wik <lars.erik.wik@northern.tech>
Date: Tue, 24 Nov 2026 11:12:08 +0100
Subject: [PATCH] Honor SOURCE_DATE_EPOCH in phar timestamps

Phar embeds wall-clock time(NULL) into every manifest entry, making
Expand All @@ -9,15 +11,17 @@ Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
---
ext/phar/phar.c | 2 +-
ext/phar/phar_internal.h | 14 ++++++++++++++
ext/phar/phar_object.c | 6 +++---
ext/phar/stream.c | 2 +-
ext/phar/tar.c | 2 +-
ext/phar/util.c | 2 +-
ext/phar/zip.c | 2 +-
5 files changed, 19 insertions(+), 3 deletions(-)
6 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index bee5fe79..3895d292 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -2950,7 +2950,7 @@
@@ -2906,7 +2906,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) int phar_flush_ex(phar_archive_data *phar, zen
4: metadata-len
+: metadata
*/
Expand All @@ -27,19 +31,20 @@ diff --git a/ext/phar/phar.c b/ext/phar/phar.c
phar_set_32(entry_buffer+4, mytime);
phar_set_32(entry_buffer+8, entry->compressed_filesize);
diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
index 7047d10a..c0dfd21f 100644
--- a/ext/phar/phar_internal.h
+++ b/ext/phar/phar_internal.h
@@ -22,12 +22,26 @@
@@ -20,12 +20,26 @@
#endif

#include <time.h>
+#include <stdlib.h>
#include "php.h"
#include "tar.h"
#include "pharzip.h"
#include "zend_hash.h"
#include "ext/spl/spl_directory.h"

+/* Reproducible-builds: honor SOURCE_DATE_EPOCH when set, else wall-clock time. */
+static inline time_t phar_source_date_epoch(void) {
+ const char *epoch = getenv("SOURCE_DATE_EPOCH");
Expand All @@ -56,36 +61,70 @@ diff --git a/ext/phar/phar_internal.h b/ext/phar/phar_internal.h
/* PHP_ because this is public information via MINFO */
#define PHP_PHAR_API_VERSION "1.1.1"
/* x.y.z maps to 0xyz0 */
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 9d3bd842..f23ac5bd 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -1367,7 +1367,7 @@ static phar_entry_data *phar_build_entry_data(zend_string *fname, char *path, si

timestamp = Z_LVAL(rv);
} else {
- timestamp = time(NULL);
+ timestamp = phar_source_date_epoch();
}

return phar_get_or_create_entry_data(fname, path, path_len, "w+b", 0, error, true, timestamp);
@@ -3640,7 +3640,7 @@ static void phar_add_file(phar_archive_data **pphar, zend_string *file_name, con
}
#endif

- phar_entry_data *data = phar_get_or_create_entry_data((*pphar)->fname, filename, filename_len, "w+b", 0, &error, true, time(NULL));
+ phar_entry_data *data = phar_get_or_create_entry_data((*pphar)->fname, filename, filename_len, "w+b", 0, &error, true, phar_source_date_epoch());
if (!data) {
if (error) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Entry %s does not exist and cannot be created: %s", filename, error);
@@ -3714,7 +3714,7 @@ static void phar_mkdir(phar_archive_data **pphar, zend_string *dir_name)
(*pphar)->fname,
ZSTR_VAL(dir_name), ZSTR_LEN(dir_name),
"w+b", 2, &error, true,
- time(NULL)
+ phar_source_date_epoch()
);
if (!data) {
if (error) {
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index 86ec22e7..f92fb7d0 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -197,7 +197,7 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
/* strip leading "/" */
internal_file = estrndup(ZSTR_VAL(resource->path) + 1, ZSTR_LEN(resource->path) - 1);
if (mode[0] == 'w' || (mode[0] == 'r' && mode[1] == '+')) {
- if (NULL == (idata = phar_get_or_create_entry_data(resource->host, internal_file, strlen(internal_file), mode, 0, &error, true, time(NULL)))) {
+ if (NULL == (idata = phar_get_or_create_entry_data(resource->host, internal_file, strlen(internal_file), mode, 0, &error, true, phar_source_date_epoch()))) {
if (error) {
php_stream_wrapper_log_warn(wrapper, context, options, CreateFailed, "%s", error);
efree(error);
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index ae1a6e46..3b4bd121 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -977,7 +977,7 @@
char *buf, *signature, sigbuf[8];

@@ -1053,7 +1053,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) int phar_tar_flush(phar_archive_data *phar, ze
char *buf, sigbuf[8];
entry.flags = PHAR_ENT_PERM_DEF_FILE;
- entry.timestamp = time(NULL);
+ entry.timestamp = phar_source_date_epoch();
entry.is_modified = 1;
entry.is_crc_checked = 1;
entry.is_tar = 1;
diff --git a/ext/phar/util.c b/ext/phar/util.c
--- a/ext/phar/util.c
+++ b/ext/phar/util.c
@@ -700,7 +700,7 @@

phar_add_virtual_dirs(phar, path, path_len);
etemp.is_modified = 1;
- etemp.timestamp = time(0);
+ etemp.timestamp = phar_source_date_epoch();
etemp.is_crc_checked = 1;
etemp.phar = phar;
etemp.filename = zend_string_init(path, path_len, false);
diff --git a/ext/phar/zip.c b/ext/phar/zip.c
index 13c34d8a..23243a31 100644
--- a/ext/phar/zip.c
+++ b/ext/phar/zip.c
@@ -1253,7 +1253,7 @@

pass.error = &temperr;
@@ -1268,7 +1268,7 @@ ZEND_ATTRIBUTE_NONNULL_ARGS(1, 4) int phar_zip_flush(phar_archive_data *phar, ze
uint32_t cdir_size, cdir_offset;

entry.flags = PHAR_ENT_PERM_DEF_FILE;
- entry.timestamp = time(NULL);
+ entry.timestamp = phar_source_date_epoch();
Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/php/cfbuild-php.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%define php_version 8.5.12
%define php_version 8.6.0

Summary: CFEngine Build Automation -- php
Name: cfbuild-php
Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/php/distfiles
Original file line number Diff line number Diff line change
@@ -1 +1 @@
81a0f450349e84b08eb43faa85f8a4c835684f3cc1c50471775d1317a046c525 php-8.5.12.tar.gz
62337dccde3d9fcc39797d4529f42637613036eaf3875353c206874e5813a3c1 php-8.6.0.tar.gz
2 changes: 1 addition & 1 deletion deps-packaging/postgresql/cfbuild-postgresql.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%define postgresql_version 18.7
%define postgresql_version 19.0

Summary: CFEngine Build Automation -- postgresql
Name: cfbuild-postgresql
Expand Down
2 changes: 1 addition & 1 deletion deps-packaging/postgresql/distfiles
Original file line number Diff line number Diff line change
@@ -1 +1 @@
441dfae4280cae3e0425e5f876f80559fb0731c140f1aae22b3e5a54d0411bfd postgresql-18.7.tar.bz2
a89fd70efbad6a08c7dbed8d4872e3af30170d9e5ca9dc7906523be95b4e692d postgresql-19.0.tar.bz2
12 changes: 6 additions & 6 deletions deps-packaging/postgresql/pg_hba.conf.sample.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
--- pg_hba.conf.sample 2019-11-11 16:03:10.000000000 -0600
+++ pg_hba.conf.socket-only 2020-01-21 13:22:44.119994084 -0600
@@ -79,11 +79,11 @@
@remove-line-for-nolocal@# "local" is for Unix domain socket connections only
@remove-line-for-nolocal@local all all @authmethodlocal@
--- pg_hba.conf.sample
+++ pg_hba.conf.socket-only
@@ -112,11 +112,11 @@
# "local" is for Unix domain socket connections only
local all all @authmethodlocal@
# IPv4 local connections:
-host all all 127.0.0.1/32 @authmethodhost@
+#host all all 127.0.0.1/32 @authmethodhost@
Expand All @@ -11,7 +11,7 @@
+#host all all ::1/128 @authmethodhost@
# Allow replication connections from localhost, by a user with the
# replication privilege.
@remove-line-for-nolocal@local replication all @authmethodlocal@
local replication all @authmethodlocal@
-host replication all 127.0.0.1/32 @authmethodhost@
-host replication all ::1/128 @authmethodhost@
+#host replication all 127.0.0.1/32 @authmethodhost@
Expand Down
164 changes: 82 additions & 82 deletions deps-packaging/postgresql/postgresql.conf.cfengine.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
--- src/backend/utils/misc/postgresql.conf.sample 2025-09-22 22:11:33.000000000 +0200
+++ src/backend/utils/misc/postgresql.conf.cfengine 2025-09-29 18:26:07.432785405 +0200
--- src/backend/utils/misc/postgresql.conf.sample
+++ src/backend/utils/misc/postgresql.conf.cfengine
@@ -1,6 +1,6 @@
-# -----------------------------
-# PostgreSQL configuration file
Expand All @@ -10,107 +10,107 @@
#
# This file consists of lines of the form:
#
@@ -62,13 +62,15 @@
# defaults to 'localhost'; use '*' for all
# (change requires restart)
#port = 5432 # (change requires restart)
-#max_connections = 100 # (change requires restart)
+max_connections = 300 # (change requires restart)
@@ -64,13 +64,15 @@
# defaults to 'localhost'; use '*' for all
# (change requires restart)
#port = 5432 # (change requires restart)
-#max_connections = 100 # (change requires restart)
+max_connections = 300 # (change requires restart)
+# Note: Increasing max_connections costs ~400 bytes of shared memory per
+# connection slot, plus lock space (see max_locks_per_transaction).
#reserved_connections = 0 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp' # comma-separated list of directories
# (change requires restart)
-#unix_socket_group = '' # (change requires restart)
-#unix_socket_permissions = 0777 # begin with 0 to use octal notation
+unix_socket_group = 'cfpostgres' # (change requires restart)
+unix_socket_permissions = 0660 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
@@ -129,7 +131,7 @@
#reserved_connections = 0 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/tmp' # comma-separated list of directories
# (change requires restart)
-#unix_socket_group = '' # (change requires restart)
-#unix_socket_permissions = 0777 # begin with 0 to use octal notation
+unix_socket_group = 'cfpostgres' # (change requires restart)
+unix_socket_permissions = 0660 # begin with 0 to use octal notation
# (change requires restart)
#bonjour = off # advertise server via Bonjour
# (change requires restart)
@@ -133,7 +135,7 @@

# - Memory -

-#shared_buffers = 128MB # min 128kB
+shared_buffers = 2GB # min 128kB
# (change requires restart)
#huge_pages = try # on, off, or try
# (change requires restart)
@@ -140,12 +142,17 @@
# (change requires restart)
-#shared_buffers = 128MB # min 128kB
+shared_buffers = 2GB # min 128kB
# (change requires restart)
#huge_pages = try # on, off, or try
# (change requires restart)
@@ -144,12 +146,17 @@
# (change requires restart)
# Caution: it is not advisable to set max_prepared_transactions nonzero unless
# you actively intend to use prepared transactions.
-#work_mem = 4MB # min 64kB
-#work_mem = 4MB # min 64kB
+
+# Note: Increasing max_prepared_transactions costs ~600 bytes of shared memory
+# per transaction slot, plus lock space (see max_locks_per_transaction).
+# It is not advisable to set max_prepared_transactions nonzero unless you
+# actively intend to use prepared transactions.
+work_mem = 48MB # min 64kB
#hash_mem_multiplier = 2.0 # 1-1000.0 multiplier on hash table work_mem
-#maintenance_work_mem = 64MB # min 64kB
+maintenance_work_mem = 512MB # min 64kB
#autovacuum_work_mem = -1 # min 64kB, or -1 to use maintenance_work_mem
-#logical_decoding_work_mem = 64MB # min 64kB
-#max_stack_depth = 2MB # min 100kB
+#logical_decoding_work_mem = 128MB # min 64kB
+max_stack_depth = 4MB # min 100kB
#shared_memory_type = mmap # the default is the first option
# supported by the operating system:
# mmap
@@ -233,7 +240,7 @@
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
-#synchronous_commit = on # synchronization level;
+synchronous_commit = off # synchronization level;
# off, local, remote_write, remote_apply, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
@@ -260,11 +267,11 @@
+work_mem = 48MB # min 64kB
#hash_mem_multiplier = 2.0 # 1-1000.0 multiplier on hash table work_mem
-#maintenance_work_mem = 64MB # min 64kB
+maintenance_work_mem = 512MB # min 64kB
#autovacuum_work_mem = -1 # min 64kB, or -1 to use maintenance_work_mem
-#logical_decoding_work_mem = 64MB # min 64kB
-#max_stack_depth = 2MB # min 100kB
+#logical_decoding_work_mem = 128MB # min 64kB
+max_stack_depth = 4MB # min 100kB
#shared_memory_type = mmap # the default is the first option
# supported by the operating system:
# mmap
@@ -249,7 +256,7 @@
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
-#synchronous_commit = on # synchronization level;
+synchronous_commit = off # synchronization level;
# off, local, remote_write, remote_apply, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
@@ -277,11 +284,11 @@

# - Checkpoints -

-#checkpoint_timeout = 5min # range 30s-1d
+checkpoint_timeout = 15min # range 30s-1d
#checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
#checkpoint_flush_after = 0 # measured in pages, 0 disables
#checkpoint_warning = 30s # 0 disables
-#checkpoint_timeout = 5min # range 30s-1d
+checkpoint_timeout = 15min # range 30s-1d
#checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
#checkpoint_flush_after = 0 # measured in pages, 0 disables
#checkpoint_warning = 30s # 0 disables
-#max_wal_size = 1GB
+max_wal_size = 4GB
#min_wal_size = 80MB

# - Prefetching during recovery -
@@ -598,7 +605,7 @@
@@ -642,7 +649,7 @@
#log_duration = off # log statement duration
#log_error_verbosity = default # terse, default, or verbose messages
#log_error_verbosity = default # terse, default, or verbose messages
#log_hostname = off
-#log_line_prefix = '%m [%p] ' # special values:
+log_line_prefix = '%t ' # special values:
# %a = application name
# %u = user name
# %d = database name
@@ -682,7 +689,7 @@
# requires track_counts to also be on.
autovacuum_worker_slots = 16 # autovacuum worker slots to allocate
# (change requires restart)
-#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
+autovacuum_max_workers = 5 # max number of autovacuum subprocesses
#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = 50 # min number of row updates before
# vacuum
@@ -691,7 +698,7 @@
# vacuums
#autovacuum_analyze_threshold = 50 # min number of row updates before
# analyze
-#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
+autovacuum_vacuum_scale_factor = 0.1 # fraction of table size before vacuum
#autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of unfrozen pages
-#log_line_prefix = '%m [%p] ' # special values:
+log_line_prefix = '%t ' # special values:
# %a = application name
# %u = user name
# %d = database name
@@ -726,7 +733,7 @@
# requires track_counts to also be on.
#autovacuum_worker_slots = 16 # autovacuum worker slots to allocate
# (change requires restart)
-#autovacuum_max_workers = 3 # max number of autovacuum subprocesses
+autovacuum_max_workers = 5 # max number of autovacuum subprocesses
#autovacuum_max_parallel_workers = 0 # limited by max_parallel_workers
#autovacuum_naptime = 1min # time between autovacuum runs
#autovacuum_vacuum_threshold = 50 # min number of row updates before
@@ -736,7 +743,7 @@
# vacuums
#autovacuum_analyze_threshold = 50 # min number of row updates before
# analyze
-#autovacuum_vacuum_scale_factor = 0.2 # fraction of table size before vacuum
+autovacuum_vacuum_scale_factor = 0.1 # fraction of table size before vacuum
#autovacuum_vacuum_insert_scale_factor = 0.2 # fraction of unfrozen pages
# before insert vacuum
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
@@ -820,6 +827,10 @@
#autovacuum_analyze_scale_factor = 0.1 # fraction of table size before analyze
@@ -871,6 +878,10 @@
# LOCK MANAGEMENT
#------------------------------------------------------------------------------

Expand All @@ -119,5 +119,5 @@
+# lock table slots.
+
#deadlock_timeout = 1s
#max_locks_per_transaction = 64 # min 10
# (change requires restart)
#max_locks_per_transaction = 128 # min 10
# (change requires restart)
Loading
Loading