From 077a47b5cfd4d97798bc4e00cbc26ac2dc2599def4680dcfefae1cd267367456 Mon Sep 17 00:00:00 2001 From: "Dr. Werner Fink" Date: Mon, 31 Jul 2023 09:46:21 +0000 Subject: [PATCH] Add file-5.45-type_t.dif OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=272 --- file-5.45-type_t.dif | 42 ++++++++++++++++++++++++++++++++++++++++++ file.changes | 7 +++++++ file.spec | 10 ++++------ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 file-5.45-type_t.dif diff --git a/file-5.45-type_t.dif b/file-5.45-type_t.dif new file mode 100644 index 0000000..adcb5f5 --- /dev/null +++ b/file-5.45-type_t.dif @@ -0,0 +1,42 @@ +--- + configure.ac | 12 ++++++++++++ + src/file.h | 6 ++++-- + 2 files changed, 16 insertions(+), 2 deletions(-) + +--- src/file.h ++++ src/file.h 2023-07-28 14:37:17.000000000 +0000 +@@ -159,9 +159,11 @@ + /* + * Dec 31, 23:59:59 9999 + * we need to make sure that we don't exceed 9999 because some libc +- * implementations like muslc crash otherwise ++ * implementations like muslc crash otherwise. If you are unlucky ++ * to be running on a system with a 32 bit time_t, then it is even less. + */ +-#define MAX_CTIME CAST(time_t, 0x3afff487cfULL) ++#define MAX_CTIME \ ++ CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL) + + #define FILE_BADSIZE CAST(size_t, ~0ul) + #define MAXDESC 64 /* max len of text description/MIME type */ +--- configure.ac ++++ configure.ac 2023-07-31 06:45:39.269468700 +0000 +@@ -152,6 +152,18 @@ AC_TYPE_UINT64_T + AC_TYPE_INT64_T + AC_TYPE_INTPTR_T + AC_TYPE_UINTPTR_T ++m4_ifdef([AC_SYS_YEAR2038], [AC_SYS_YEAR2038], [ ++# GNU libc only allows setting _TIME_BITS when FILE_OFFSET_BITS is also set. ++# GNU libc defines __TIMESIZE on systems where _TIME_BITS can be set. ++AS_IF([test X"$ac_cv_sys_file_offset_bits" = X"64"], [ ++ AC_CHECK_DECL(__TIMESIZE, [ ++ AC_DEFINE([_TIME_BITS], [64], [Number of bits in a timestamp, on hosts where this is settable.]) ++ ], [], [ ++AC_INCLUDES_DEFAULT ++#include ++ ]) ++ ]) ++]) + AC_FUNC_MMAP + AC_FUNC_FORK + AC_FUNC_MBRTOWC diff --git a/file.changes b/file.changes index 51b6e1e..5ad3704 100644 --- a/file.changes +++ b/file.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Jul 31 09:44:14 UTC 2023 - Dr. Werner Fink + +- Add patch file-5.45-type_t.dif + * Partly upstream check of type_t is wide on 23bit systems + * Extend (auto)configure to enable wide type_t type if possible + ------------------------------------------------------------------- Fri Jul 28 11:51:24 UTC 2023 - Dr. Werner Fink diff --git a/file.spec b/file.spec index 8603b42..cb3bd67 100644 --- a/file.spec +++ b/file.spec @@ -63,6 +63,8 @@ Patch31: file-5.19-biorad.dif Patch32: file-5.19-clicfs.dif Patch37: file-secure_getenv.patch Patch39: file-5.28-btrfs-image.dif +# PATCH-FIX-UPSTREAM: Support max time_t on 32bit +Patch42: file-5.45-type_t.dif BuildRoot: %{_tmppath}/%{name}-%{version}-build %global _sysconfdir /etc %global magicdir %{_datadir}/file @@ -107,6 +109,7 @@ to develop applications that require the magic "file" interface. %prep %setup -q -n file-%{version} +%patch42 -p0 -b .t_t %patch1 -p0 -b .misc %patch4 -p0 -b .conf %patch5 -p0 -b .tex @@ -135,12 +138,7 @@ export LC_ALL=POSIX rm -f Magdir/*,v Magdir/*~ rm -f ltcf-c.sh ltconfig ltmain.sh autoreconf -fiv -REQ64="$(getconf LFS_CFLAGS)" -if test -n "${REQ64}" -then - REQ64="${REQ64} -D_TIME_BITS=64" -fi -export CFLAGS="%{optflags} -DHOWMANY=69632 -fPIE $(pkg-config libseccomp --cflags) ${REQ64}" +export CFLAGS="%{optflags} -DHOWMANY=69632 -fPIE $(pkg-config libseccomp --cflags)" %configure --disable-silent-rules --datadir=%{magicdir} \ --disable-static \ --enable-fsect-man5