Add file-5.45-type_t.dif

OBS-URL: https://build.opensuse.org/package/show/Base:System/file?expand=0&rev=272
This commit is contained in:
Dr. Werner Fink 2023-07-31 09:46:21 +00:00 committed by Git OBS Bridge
parent df097d6f94
commit ad7a15413c
3 changed files with 53 additions and 6 deletions

42
file-5.45-type_t.dif Normal file
View File

@ -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 <time.h>
+ ])
+ ])
+])
AC_FUNC_MMAP
AC_FUNC_FORK
AC_FUNC_MBRTOWC

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Jul 31 09:44:14 UTC 2023 - Dr. Werner Fink <werner@suse.de>
- 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 <werner@suse.de>

View File

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