Skip to content

Commit

Permalink
Revert "Update libmagic to version 5.45 (#4673)". (#4808)
Browse files Browse the repository at this point in the history
This reverts commit 7753f33.

---
TYPE: NO_HISTORY
DESC: Revert "Update libmagic to version 5.45 (#4673)"
  • Loading branch information
KiterLuc authored Mar 13, 2024
1 parent fdb5674 commit 0ae4818
Show file tree
Hide file tree
Showing 32 changed files with 1,239 additions and 356 deletions.
11 changes: 0 additions & 11 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ build:
os: "ubuntu-22.04"
tools:
python: "3.8"
apt_packages:
- autoconf
- autoconf-archive
- automake
- curl
- git
- libtool
- make
- pkg-config
- unzip
- zip

python:
install:
Expand Down
1 change: 0 additions & 1 deletion doc/dev/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ title: Building TileDB from source
* Apple Clang 14
* Git (required by vcpkg)
* curl (required by vcpkg on non-Windows)
* autoconf (required by building libmagic on non-Windows)

## Downloading the source code

Expand Down
3 changes: 2 additions & 1 deletion ports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ After copying the port, add an entry to the table below. You should also contrib

|Port|Reason|
|----|------|
|`libmagic`|Updating to the upstream port deferred due to failures.|
|`openssl`|Pinning to OpenSSL 1.1 until we can move to 3.0 in January 2024.|
|`pcre2`|To be removed alongside libmagic.|
|`azure-storage-common-cpp`|Patching to disable default features on libxml2 (https://github.com/Azure/azure-sdk-for-cpp/pull/5221).|
|`libmagic`|Patching to add features explicitly enabling compression support.|
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ index c548e97..299ac0c 100644
#include <errno.h>
#include <fcntl.h> /* For open and flags */
-#include <regex.h>
+#include <tre/regex.h>
+#include <pcre2posix.h>
#include <time.h>
#include <sys/types.h>
#ifndef WIN32
Expand Down

This file was deleted.

10 changes: 5 additions & 5 deletions ports/libmagic/0003-Fix-WIN32-macro-checks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ index 299ac0c..2c365a6 100644
--- a/src/file.h
+++ b/src/file.h
@@ -82,7 +82,7 @@
#include <tre/regex.h>
#include <pcre2posix.h>
#include <time.h>
#include <sys/types.h>
-#ifndef WIN32
Expand All @@ -31,13 +31,13 @@ index 299ac0c..2c365a6 100644
#define PATHSEP ':'
@@ -103,7 +103,7 @@

#define file_private static
#define private static

-#if HAVE_VISIBILITY && !defined(WIN32)
+#if HAVE_VISIBILITY && !defined(_WIN32)
#define file_public __attribute__ ((__visibility__("default")))
#ifndef file_protected
#define file_protected __attribute__ ((__visibility__("hidden")))
#define public __attribute__ ((__visibility__("default")))
#ifndef protected
#define protected __attribute__ ((__visibility__("hidden")))
--
2.29.2.windows.2

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@ diff --git a/src/file.h b/src/file.h
index 0332506..4aa9f60 100644
--- a/src/file.h
+++ b/src/file.h
@@ -88,7 +88,8 @@
@@ -88,6 +88,7 @@
/* Do this here and now, because struct stat gets re-defined on solaris */
#include <sys/stat.h>
#include <stdarg.h>
+#include <dirent.h>
#include <locale.h>
#if defined(HAVE_XLOCALE_H)
#include <xlocale.h>
#endif

#define ENABLE_CONDITIONALS

--
2.29.2.windows.2

2 changes: 1 addition & 1 deletion ports/libmagic/0006-Remove-Wrap-POSIX-headers.patch
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ index 3ab52d1..fc48d84 100644
--- a/src/pread.c
+++ b/src/pread.c
@@ -3,7 +3,9 @@
FILE_RCSID("@(#)$File: pread.c,v 1.5 2022/09/24 20:30:13 christos Exp $")
FILE_RCSID("@(#)$File: pread.c,v 1.2 2013/04/02 16:23:07 christos Exp $")
#endif /* lint */
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
Expand Down
25 changes: 25 additions & 0 deletions ports/libmagic/0009-No-fcntl-in-magic.c.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From 6d10bef865b69764f6e0ddd2b0f6a84e484cdb37 Mon Sep 17 00:00:00 2001
From: Long Nguyen <[email protected]>
Date: Sun, 9 May 2021 13:25:14 +0700
Subject: [PATCH 09/14] No fcntl in magic.c

---
src/magic.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/magic.c b/src/magic.c
index e9aeafa..382bd96 100644
--- a/src/magic.c
+++ b/src/magic.c
@@ -462,7 +462,7 @@ file_or_fd(struct magic_set *ms, const char *inname, int fd)
rv = 0;
goto done;
}
-#if O_CLOEXEC == 0
+#if O_CLOEXEC == 0 && !defined(_WIN32)
(void)fcntl(fd, F_SETFD, FD_CLOEXEC);
#endif
}
--
2.29.2.windows.2

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ index 5204f20..7244841 100644
#undef HAVE_MAJOR
-#ifdef S_IFLNK
+#if S_IFLNK != 0
file_private int
private int
bad_link(struct magic_set *ms, int err, char *buf)
{
@@ -108,7 +108,7 @@ file_fsmagic(struct magic_set *ms, const char *fn, struct stat *sb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,21 @@ diff --git a/src/funcs.c b/src/funcs.c
index b926625..b585486 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -888,5 +888,6 @@
@@ -809,6 +809,7 @@ file_print_guid(char *str, size_t len, const uint64_t *guid)
g->data4[6], g->data4[7]);
}

+#ifndef _WIN32
file_protected int
protected int
file_pipe_closexec(int *fds)
{
@@ -914,5 +915,6 @@
#endif
@@ -827,6 +828,7 @@ protected int
file_clear_closexec(int fd) {
return fcntl(fd, F_SETFD, 0);
}
+#endif

file_protected char *
protected char *
file_strtrim(char *str)
--
2.29.2.windows.2
Expand Down
24 changes: 0 additions & 24 deletions ports/libmagic/0012-Convert-MSYS2-paths-to-Windows-paths.patch

This file was deleted.

42 changes: 0 additions & 42 deletions ports/libmagic/0013-Check-for-backslash-in-argv-0-on-Windows.patch

This file was deleted.

38 changes: 38 additions & 0 deletions ports/libmagic/0014-Define-POSIX-macros-if-missing.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From fa0e11f36bb0e322250e1e488ced9f2bf166874f Mon Sep 17 00:00:00 2001
From: Long Nguyen <[email protected]>
Date: Fri, 14 May 2021 18:11:39 +0700
Subject: [PATCH 14/14] Define POSIX macros if missing

---
src/file.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/src/file.h b/src/file.h
index ccfe0da..98cd37b 100644
--- a/src/file.h
+++ b/src/file.h
@@ -100,6 +100,21 @@
#include <stdarg.h>
#include <dirent.h>

+#if !defined(S_IFBLK)
+#define S_IFBLK 0
+#define S_ISBLK(mode) (((mode) & S_IFMT) == S_IFBLK)
+#endif
+
+#if !defined(S_IFLNK)
+#define S_IFLNK 0
+#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+#endif
+
+#if !defined(S_IFSOCK)
+#define S_IFSOCK 0
+#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK)
+#endif
+
#define ENABLE_CONDITIONALS

#ifndef MAGIC
--
2.29.2.windows.2

8 changes: 4 additions & 4 deletions ports/libmagic/0015-MSYS2-Remove-ioctl-call.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ diff --git a/src/compress.c b/src/compress.c
index 33ce2bc..f172eda 100644
--- a/src/compress.c
+++ b/src/compress.c
@@ -407,7 +407,7 @@
@@ -378,7 +378,7 @@
sread(int fd, void *buf, size_t n, int canbepipe __attribute__((__unused__)))
{
ssize_t rv;
-#if defined(FIONREAD) && !defined(__MINGW32__)
-#ifdef FIONREAD
+#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32)
int t = 0;
#endif
size_t rn = n;
@@ -418,7 +418,7 @@
@@ -386,7 +386,7 @@
if (fd == STDIN_FILENO)
goto nocheck;

-#if defined(FIONREAD) && !defined(__MINGW32__)
-#ifdef FIONREAD
+#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32)
if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
#ifdef FD_ZERO
Expand Down
40 changes: 0 additions & 40 deletions ports/libmagic/0016-Fix-file_famagic-function.patch

This file was deleted.

Loading

0 comments on commit 0ae4818

Please sign in to comment.