[File] Error on 32bit for file 5.45

Christos Zoulas christos at zoulas.com
Fri Jul 28 14:38:11 UTC 2023


How about this?

christos

Index: file.h
===================================================================
RCS file: /p/file/cvsroot/file/src/file.h,v
retrieving revision 1.247
diff -u -p -u -r1.247 file.h
--- file.h      27 Jul 2023 19:40:22 -0000      1.247
+++ file.h      28 Jul 2023 14:37:17 -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 */


> On Jul 28, 2023, at 7:51 AM, Dr. Werner Fink <werner at suse.de> wrote:
> 
> Signed PGP part
> The problem can be avoided with
> 
> REQ64="$(getconf LFS_CFLAGS)"
> if test -n "${REQ64}"
> then
>     REQ64="${REQ64} -D_TIME_BITS=64"
> fi
> 
> to extend the CFLAGS with $REQ64 which make the new MAX_CTIME test
> in file-5.45/src/print.c work
> 
> +       if (t > MAX_CTIME)
> +               goto out;
> +
> 
> Werner
> 
> On 2023/07/28 13:24:18 +0200, Dr. Werner Fink wrote:
>> Hi
>> 
>> on both i586/i686 and armv7l I see
>> 
>> TZ=UTC MAGIC=../magic/magic ./test -e ../tests/fit-map-data.testfile ../tests/fit-map-data.result
>> test: ERROR: result was (len 124)
>> FIT Map data, unit id 65536, serial 3879446968, *Invalid datetime*, manufacturer 1 (garmin), product 1632, type 4 (Activity)
>> expected (len 131)
>> FIT Map data, unit id 65536, serial 3879446968, Sat May 31 10:00:34 2014, manufacturer 1 (garmin), product 1632, type 4 (Activity)
>> 
>> if I disable `set -e´ in the Makefile below tests/ I see more errors:
>> 
>> abuild at noether:~/rpmbuild/BUILD/file-5.45/tests> make check |& grep -iE 'error|Invalid'
>> test: ERROR: result was (len 124)
>> FIT Map data, unit id 65536, serial 3879446968, *Invalid datetime*, manufacturer 1 (garmin), product 1632, type 4 (Activity)
>> ../tests/fit-map-data.testfile: FIT Map data, unit id 65536, serial 3879446968, *Invalid datetime*, manufacturer 1 (garmin), product 1632, type 4 (Activity)
>> test: ERROR: result was (len 131)
>> OpenPGP Public Key Version 2, Created *Invalid datetime*, RSA (Encrypt or Sign, 1024 bits); User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v2-phil.testfile: OpenPGP Public Key Version 2, Created *Invalid datetime*, RSA (Encrypt or Sign, 1024 bits); User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 131)
>> OpenPGP Public Key Version 3, Created *Invalid datetime*, RSA (Encrypt or Sign, 1127 bits); User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v3-lutz.testfile: OpenPGP Public Key Version 3, Created *Invalid datetime*, RSA (Encrypt or Sign, 1127 bits); User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 114)
>> OpenPGP Public Key Version 4, Created *Invalid datetime*, DSA (1024 bits); User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-dsa.testfile: OpenPGP Public Key Version 4, Created *Invalid datetime*, DSA (1024 bits); User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 110)
>> OpenPGP Secret Key Version 4, Created *Invalid datetime*, EdDSA; Signature; Secret Subkey; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-ecc-no-userid-secret.testfile: OpenPGP Secret Key Version 4, Created *Invalid datetime*, EdDSA; Signature; Secret Subkey; OpenPGP Certificate
>> test: ERROR: result was (len 104)
>> OpenPGP Secret Key Version 4, Created *Invalid datetime*, EdDSA; User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-ecc-secret-key.testfile: OpenPGP Secret Key Version 4, Created *Invalid datetime*, EdDSA; User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 131)
>> OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-rsa-key.testfile: OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 137)
>> OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); Signature; Secret Subkey; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-rsa-no-userid-secret.testfile: OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); Signature; Secret Subkey; OpenPGP Certificate
>> test: ERROR: result was (len 131)
>> OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate
>> ../tests/pgp-binary-key-v4-rsa-secret-key.testfile: OpenPGP Secret Key Version 4, Created *Invalid datetime*, RSA (Encrypt or Sign, 3072 bits); User ID; Signature; OpenPGP Certificate
>> test: ERROR: result was (len 186)
>> AMD/Xilinx accelerator AXLF (xclbin) file, 46226070 bytes, created *Invalid datetime*, shell "xilinx_u55c_gen3x16_xdma_3_202210_1", uuid e106e953-cf90-4024-e075-282d1a7d820b, 11 sections
>> ../tests/xclbin.testfile: AMD/Xilinx accelerator AXLF (xclbin) file, 46226070 bytes, created *Invalid datetime*, shell "xilinx_u55c_gen3x16_xdma_3_202210_1", uuid e106e953-cf90-4024-e075-282d1a7d820b, 11 sections
>> 
>> Werner
>> 
> --
>  "Having a smoking section in a restaurant is like having
>          a peeing section in a swimming pool." -- Edward Burr
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <https://mailman.astron.com/pipermail/file/attachments/20230728/5275561e/attachment.asc>


More information about the File mailing list