logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>
commit: 016b9511d2fd6bac25a42ea15c298451a6daad30
parent 634ec99771cf0bd3aa3294e1401e2fc666009f6a
Author: fosslinux <fosslinux@aussies.space>
Date:   Fri, 14 Jan 2022 16:24:39 +1100

Make gzip-1.2.4 and tar-1.12 not include timestamps

There is no way for gzip 1.2.4 and tar 1.12 to disable the inclusion of
timestamps into the tarball/gzip, which creates non-reproducible
tarballs and hence packages.

While it is theoretically possible to set the timestamps to unix time 0
using touch, in reality this is not possible because mes libc does not
support utime() which sets the timestamp of a file from userspace. So we
need to ignore it rather than (re)set it.

Diffstat:

Msysa/gzip-1.2.4/checksums2+-
Asysa/gzip-1.2.4/files/stat_override.c30++++++++++++++++++++++++++++++
Msysa/gzip-1.2.4/gzip-1.2.4.kaem7+++++++
Msysa/tar-1.12/checksums2+-
Asysa/tar-1.12/files/stat_override.c30++++++++++++++++++++++++++++++
Msysa/tar-1.12/tar-1.12.kaem2++
6 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/sysa/gzip-1.2.4/checksums b/sysa/gzip-1.2.4/checksums @@ -1 +1 @@ -304cead634e6766db915155d422049269f66b2ff34a20a7f20819a0c69193d33 /usr/bin/gzip +062e34d3f2d4bcb339ce3be80a1b6bc0ff805d70c8c13d9a6ad6e7a93914a1bf /usr/bin/gzip diff --git a/sysa/gzip-1.2.4/files/stat_override.c b/sysa/gzip-1.2.4/files/stat_override.c @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <sys/stat.h> +#include <linux/syscall.h> +#include <linux/x86/syscall.h> + +int _stat(const char *path, struct stat *buf) { + int rc = stat(path, buf); + if (rc == 0) { + buf->st_atime = 0; + buf->st_mtime = 0; + } + return rc; +} + +int _lstat(const char *path, struct stat *buf) { + int rc = lstat(path, buf); + if (rc == 0) { + buf->st_atime = 0; + buf->st_mtime = 0; + } + return rc; +} + +#define stat(a,b) _stat(a,b) +#define lstat(a,b) _lstat(a,b) diff --git a/sysa/gzip-1.2.4/gzip-1.2.4.kaem b/sysa/gzip-1.2.4/gzip-1.2.4.kaem @@ -11,11 +11,18 @@ set -ex mkdir build cd build +catm gzip.c.new ../../files/stat_override.c gzip.c +cp gzip.c.new gzip.c + # Extract ungz ../src/${pkg}.tar.gz untar ../src/${pkg}.tar cd ${pkg} +# Prepare +catm gzip.c.new ../../files/stat_override.c gzip.c +cp gzip.c.new gzip.c + # Compile tcc -c -DNO_UTIME gzip.c tcc -c bits.c diff --git a/sysa/tar-1.12/checksums b/sysa/tar-1.12/checksums @@ -1 +1 @@ -d4ac49a136cb18e47fa4be447657746b3620d6e5bc15daa0b825f44734945a7c /usr/bin/tar +3d67caa46470a7c1f3b00b8301977bc1093fab333943aabfd84afaa1bd77a609 /usr/bin/tar diff --git a/sysa/tar-1.12/files/stat_override.c b/sysa/tar-1.12/files/stat_override.c @@ -0,0 +1,30 @@ +/* + * SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include <sys/stat.h> +#include <linux/syscall.h> +#include <linux/x86/syscall.h> + +int _stat(const char *path, struct stat *buf) { + int rc = stat(path, buf); + if (rc == 0) { + buf->st_atime = 0; + buf->st_mtime = 0; + } + return rc; +} + +int _lstat(const char *path, struct stat *buf) { + int rc = lstat(path, buf); + if (rc == 0) { + buf->st_atime = 0; + buf->st_mtime = 0; + } + return rc; +} + +#define stat(a,b) _stat(a,b) +#define lstat(a,b) _lstat(a,b) diff --git a/sysa/tar-1.12/tar-1.12.kaem b/sysa/tar-1.12/tar-1.12.kaem @@ -18,6 +18,8 @@ untar ../src/${pkg}.tar cd ${pkg} cp ../../files/getdate_stub.c lib/getdate_stub.c +catm src/create.c.new ../../files/stat_override.c src/create.c +cp src/create.c.new src/create.c # Compile