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.
This commit is contained in:
fosslinux 2022-01-14 16:24:39 +11:00
parent 634ec99771
commit 016b9511d2
6 changed files with 71 additions and 2 deletions

View file

@ -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)