commit: f29547f5c57342132f86b7c289a6681fd76b033a
parent cadf4e2bf4582b257aa4ba9fb4350990aaf2dd67
Author: Michael Forney <mforney@mforney.org>
Date: Fri, 20 Dec 2019 15:54:11 -0800
file: Update to 5.38
Diffstat:
5 files changed, 84 insertions(+), 54 deletions(-)
diff --git a/pkg/file/config.h b/pkg/file/config.h
@@ -1,8 +1,10 @@
/* #undef AC_APPLE_UNIVERSAL_BUILD */
#define BUILTIN_ELF 1
+/* #undef BZLIBSUPPORT */
#define ELFCORE 1
#define HAVE_ASCTIME_R 1
#define HAVE_ASPRINTF 1
+/* #undef HAVE_BZLIB_H */
#define HAVE_CTIME_R 1
#define HAVE_DAYLIGHT 1
#define HAVE_DECL_DAYLIGHT 1
@@ -22,10 +24,13 @@
#define HAVE_GMTIME_R 1
#define HAVE_INTPTR_T 1
#define HAVE_INTTYPES_H 1
+/* #undef HAVE_LIBBZ2 */
/* #undef HAVE_LIBGNURX */
+/* #undef HAVE_LIBLZMA */
/* #undef HAVE_LIBSECCOMP */
#define HAVE_LIBZ 1
#define HAVE_LOCALTIME_R 1
+/* #undef HAVE_LZMA_H */
#define HAVE_MBRTOWC 1
#define HAVE_MBSTATE_T 1
#define HAVE_MEMMEM 1
@@ -69,7 +74,6 @@
#define HAVE_VASPRINTF 1
#define HAVE_VFORK 1
/* #undef HAVE_VFORK_H */
-#define HAVE_VISIBILITY 1
#define HAVE_WCHAR_H 1
#define HAVE_WCTYPE_H 1
#define HAVE_WCWIDTH 1
@@ -79,14 +83,14 @@
#define HAVE_ZLIB_H 1
#define LT_OBJDIR ".libs/"
/* #undef MAJOR_IN_MKDEV */
-/* #undef MAJOR_IN_SYSMACROS */
+#define MAJOR_IN_SYSMACROS 1
#define PACKAGE "file"
#define PACKAGE_BUGREPORT "christos@astron.com"
#define PACKAGE_NAME "file"
-#define PACKAGE_STRING "file 5.37"
+#define PACKAGE_STRING "file 5.38"
#define PACKAGE_TARNAME "file"
#define PACKAGE_URL ""
-#define PACKAGE_VERSION "5.37"
+#define PACKAGE_VERSION "5.38"
#define STDC_HEADERS 1
/* #undef TM_IN_SYS_TIME */
#ifndef _ALL_SOURCE
@@ -104,7 +108,7 @@
#ifndef __EXTENSIONS__
# define __EXTENSIONS__ 1
#endif
-#define VERSION "5.37"
+#define VERSION "5.38"
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
@@ -114,6 +118,7 @@
/* # undef WORDS_BIGENDIAN */
# endif
#endif
+/* #undef XZLIBSUPPORT */
#define ZLIBSUPPORT 1
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
@@ -127,7 +132,6 @@
/* #undef _UINT32_T */
/* #undef _UINT64_T */
/* #undef _UINT8_T */
-/* #undef const */
/* #undef int32_t */
/* #undef int64_t */
/* #undef intptr_t */
diff --git a/pkg/file/gen.lua b/pkg/file/gen.lua
@@ -27,8 +27,8 @@ pkg.deps = {'$dir/headers', 'pkg/zlib/headers'}
lib('libmagic.a', [[src/(
buffer.c magic.c apprentice.c softmagic.c ascmagic.c
- encoding.c compress.c is_json.c is_tar.c readelf.c print.c fsmagic.c
- funcs.c apptype.c der.c
+ encoding.c compress.c is_csv.c is_json.c is_tar.c readelf.c print.c
+ fsmagic.c funcs.c apptype.c der.c
cdf.c cdf_time.c readcdf.c
fmtcheck.c
diff --git a/pkg/file/magic.txt b/pkg/file/magic.txt
@@ -90,6 +90,7 @@ finger
flash
flif
fonts
+forth
fortran
frame
freebsd
@@ -101,6 +102,7 @@ gconv
geo
geos
gimp
+git
glibc
gnome
gnu
@@ -170,6 +172,7 @@ mkid
mlssa
mmdf
modem
+modulefile
motorola
mozilla
msdos
@@ -193,6 +196,8 @@ ocaml
octave
ole2compounddocs
olf
+openfst
+opentimestamps
os2
os400
os9
@@ -213,6 +218,7 @@ pgp
pkgadd
plan9
plus5
+pmem
polyml
printer
project
@@ -229,6 +235,7 @@ rinex
rpi
rpm
rpmsg
+rst
rtf
ruby
sc
@@ -249,6 +256,7 @@ smalltalk
smile
sniffer
softquad
+sosi
spec
spectrum
sql
diff --git a/pkg/file/patch/0001-Avoid-cast-of-address-constant-to-integer-constant-i.patch b/pkg/file/patch/0001-Avoid-cast-of-address-constant-to-integer-constant-i.patch
@@ -1,18 +1,32 @@
-From a57afd937b20e0855d663854e1c1e0a9503b5b6a Mon Sep 17 00:00:00 2001
+From 349dc7a8e768c5c81e9b88131828ee168e66344a Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Mon, 17 Jun 2019 23:54:24 -0700
Subject: [PATCH] Avoid cast of address constant to integer constant in
initalizer
+Upstream: https://mailman.astron.com/pipermail/file/2019-December/000247.html
+RCAST converts an address constant to an integer, and then to pointer. An
+integer constant cast to a pointer type is a valid address constant,
+however, a pointer cast to a integer is not an integer constant:
+
+> Cast operators in an integer constant expression shall only convert
+> arithmetic types to integer types, except as part of an operand to the
+> sizeof operator.
+
+So the result of RCAST(const void *, zlibcmp) is not technically a
+constant expression, and might be rejected by some compilers when it is
+used in an initializer for an object with static storage.
+
+Instead, just use a union so no casts are necessary.
---
- src/compress.c | 38 ++++++++++++++++++++------------------
- 1 file changed, 20 insertions(+), 18 deletions(-)
+ src/compress.c | 40 +++++++++++++++++++++-------------------
+ 1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/compress.c b/src/compress.c
-index 95e42a24..3df6f02c 100644
+index 33ce2bc9..569c87e8 100644
--- a/src/compress.c
+++ b/src/compress.c
-@@ -146,30 +146,33 @@ static const char *zstd_args[] = {
+@@ -161,7 +161,10 @@ static const char *zstd_args[] = {
#define do_bzlib NULL
private const struct {
@@ -21,60 +35,64 @@ index 95e42a24..3df6f02c 100644
+ const void *magic;
+ int (*func)(const unsigned char *);
+ } u;
- size_t maglen;
+ int maglen;
const char **argv;
void *unused;
- } compr[] = {
-- { "\037\235", 2, gzip_args, NULL }, /* compressed */
-+ { { "\037\235" }, 2, gzip_args, NULL }, /* compressed */
+@@ -171,26 +174,26 @@ private const struct {
+ #define METH_XZ 9
+ #define METH_LZMA 13
+ #define METH_ZLIB 14
+- { "\037\235", 2, gzip_args, NULL }, /* 0, compressed */
++ { { "\037\235" }, 2, gzip_args, NULL }, /* 0, compressed */
/* Uncompress can get stuck; so use gzip first if we have it
* Idea from Damien Clark, thanks! */
-- { "\037\235", 2, uncompress_args, NULL }, /* compressed */
-- { "\037\213", 2, gzip_args, do_zlib }, /* gzipped */
-- { "\037\236", 2, gzip_args, NULL }, /* frozen */
-- { "\037\240", 2, gzip_args, NULL }, /* SCO LZH */
-+ { { "\037\235" }, 2, uncompress_args, NULL }, /* compressed */
-+ { { "\037\213" }, 2, gzip_args, do_zlib }, /* gzipped */
-+ { { "\037\236" }, 2, gzip_args, NULL }, /* frozen */
-+ { { "\037\240" }, 2, gzip_args, NULL }, /* SCO LZH */
+- { "\037\235", 2, uncompress_args, NULL }, /* 1, compressed */
+- { "\037\213", 2, gzip_args, do_zlib }, /* 2, gzipped */
+- { "\037\236", 2, gzip_args, NULL }, /* 3, frozen */
+- { "\037\240", 2, gzip_args, NULL }, /* 4, SCO LZH */
++ { { "\037\235" }, 2, uncompress_args, NULL }, /* 1, compressed */
++ { { "\037\213" }, 2, gzip_args, do_zlib }, /* 2, gzipped */
++ { { "\037\236" }, 2, gzip_args, NULL }, /* 3, frozen */
++ { { "\037\240" }, 2, gzip_args, NULL }, /* 4, SCO LZH */
/* the standard pack utilities do not accept standard input */
-- { "\037\036", 2, gzip_args, NULL }, /* packed */
-- { "PK\3\4", 4, gzip_args, NULL }, /* pkzipped, */
-+ { { "\037\036" }, 2, gzip_args, NULL }, /* packed */
-+ { { "PK\3\4" }, 4, gzip_args, NULL }, /* pkzipped, */
+- { "\037\036", 2, gzip_args, NULL }, /* 5, packed */
+- { "PK\3\4", 4, gzip_args, NULL }, /* 6, pkzipped, */
++ { { "\037\036" }, 2, gzip_args, NULL }, /* 5, packed */
++ { { "PK\3\4" }, 4, gzip_args, NULL }, /* 6, pkzipped, */
/* ...only first file examined */
-- { "BZh", 3, bzip2_args, do_bzlib }, /* bzip2-ed */
-- { "LZIP", 4, lzip_args, NULL }, /* lzip-ed */
-- { "\3757zXZ\0", 6, xz_args, NULL }, /* XZ Utils */
-- { "LRZI", 4, lrzip_args, NULL }, /* LRZIP */
-- { "\004\"M\030",4, lz4_args, NULL }, /* LZ4 */
-- { "\x28\xB5\x2F\xFD", 4, zstd_args, NULL }, /* zstd */
-+ { { "BZh" }, 3, bzip2_args, do_bzlib }, /* bzip2-ed */
-+ { { "LZIP" }, 4, lzip_args, NULL }, /* lzip-ed */
-+ { { "\3757zXZ\0" }, 6, xz_args, NULL }, /* XZ Utils */
-+ { { "LRZI" }, 4, lrzip_args, NULL }, /* LRZIP */
-+ { { "\004\"M\030" }, 4, lz4_args, NULL }, /* LZ4 */
-+ { { "\x28\xB5\x2F\xFD" }, 4, zstd_args, NULL }, /* zstd */
+- { "BZh", 3, bzip2_args, do_bzlib }, /* 7, bzip2-ed */
+- { "LZIP", 4, lzip_args, NULL }, /* 8, lzip-ed */
+- { "\3757zXZ\0", 6, xz_args, NULL }, /* 9, XZ Utils */
+- { "LRZI", 4, lrzip_args, NULL }, /* 10, LRZIP */
+- { "\004\"M\030",4, lz4_args, NULL }, /* 11, LZ4 */
+- { "\x28\xB5\x2F\xFD", 4, zstd_args, NULL }, /* 12, zstd */
+- { RCAST(const void *, lzmacmp), -13, xz_args, NULL }, /* 13, lzma */
++ { { "BZh" }, 3, bzip2_args, do_bzlib }, /* 7, bzip2-ed */
++ { { "LZIP" }, 4, lzip_args, NULL }, /* 8, lzip-ed */
++ { { "\3757zXZ\0" }, 6, xz_args, NULL }, /* 9, XZ Utils */
++ { { "LRZI" }, 4, lrzip_args, NULL }, /* 10, LRZIP */
++ { { "\004\"M\030" }, 4, lz4_args, NULL }, /* 11, LZ4 */
++ { { "\x28\xB5\x2F\xFD" }, 4, zstd_args, NULL }, /* 12, zstd */
++ { { .func = lzmacmp }, -13, xz_args, NULL }, /* 13, lzma */
#ifdef ZLIBSUPPORT
-- { RCAST(const void *, zlibcmp), 0, zlib_args, NULL }, /* zlib */
-+ { { .func = zlibcmp }, 0, zlib_args, NULL }, /* zlib */
+- { RCAST(const void *, zlibcmp), -2, zlib_args, NULL }, /* 14, zlib */
++ { { .func = zlibcmp }, -2, zlib_args, NULL }, /* 14, zlib */
#endif
};
-@@ -238,11 +241,10 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
+@@ -262,10 +265,9 @@ file_zmagic(struct magic_set *ms, const struct buffer *b, const char *name)
+ if (nbytes < CAST(size_t, abs(compr[i].maglen)))
continue;
- #ifdef ZLIBSUPPORT
- if (compr[i].maglen == 0)
+ if (compr[i].maglen < 0) {
- zm = (RCAST(int (*)(const unsigned char *),
- CCAST(void *, compr[i].magic)))(buf);
+ zm = compr[i].u.func(buf);
- else
- #endif
-- zm = memcmp(buf, compr[i].magic, compr[i].maglen) == 0;
-+ zm = memcmp(buf, compr[i].u.magic, compr[i].maglen) == 0;
+ } else {
+- zm = memcmp(buf, compr[i].magic,
++ zm = memcmp(buf, compr[i].u.magic,
+ CAST(size_t, compr[i].maglen)) == 0;
+ }
- if (!zm)
- continue;
--
-2.20.1
+2.24.1
diff --git a/pkg/file/ver b/pkg/file/ver
@@ -1 +1 @@
-5.37 r1
+5.38 r0