Skip to content

Commit

Permalink
Update the libmagic vcpkg port overlay to version 5.45. (#5332)
Browse files Browse the repository at this point in the history
[SC-56749](https://app.shortcut.com/tiledb-inc/story/56749/update-the-libmagic-vcpkg-port-overlay-to-version-5-45)

This PR updates our custom vcpkg port overlay for libmagic to version
5.45. Unlike the last time we attempted this (#4673), this PR does not
replace the port with the upstream autotools-based one, and is not
expected to be a build-breaking change.

---
TYPE: IMPROVEMENT
DESC: Updated libmagic to version 5.45.
  • Loading branch information
teo-tsirpanis authored Oct 2, 2024
1 parent 4418b8a commit c44fb49
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 88 deletions.
2 changes: 1 addition & 1 deletion ports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ For ease of review when patching existing ports, you are recommended to make one
|---------------|----------------------------------------------------------------------------------------------------------------------------|
| `aws-c-io` | Patching to fix MinGW build failures. (https://github.com/awslabs/aws-c-io/pull/664) |
| `aws-sdk-cpp` | Patching to fix MinGW build failures, and to avoid building test-only SDKs (https://github.com/aws/aws-sdk-cpp/pull/3061). |
| `libmagic` | Updating to the upstream port deferred due to failures. |
| `libmagic` | Using a custom CMake-based port that is not accepted upstream. |
| `libfaketime` | Port does not yet exist upstream |
8 changes: 4 additions & 4 deletions ports/libmagic/0003-Fix-WIN32-macro-checks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ index 299ac0c..2c365a6 100644
#define PATHSEP ':'
@@ -103,7 +103,7 @@

#define private static
#define file_private static

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

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

#define ENABLE_CONDITIONALS

#include <locale.h>
#if defined(HAVE_XLOCALE_H)
#include <xlocale.h>
#endif
--
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.2 2013/04/02 16:23:07 christos Exp $")
FILE_RCSID("@(#)$File: pread.c,v 1.5 2022/09/24 20:30:13 christos Exp $")
#endif /* lint */
#include <fcntl.h>
+#ifdef HAVE_UNISTD_H
Expand Down
25 changes: 0 additions & 25 deletions ports/libmagic/0009-No-fcntl-in-magic.c.patch

This file was deleted.

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
private int
file_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,21 +11,19 @@ diff --git a/src/funcs.c b/src/funcs.c
index b926625..b585486 100644
--- a/src/funcs.c
+++ b/src/funcs.c
@@ -809,6 +809,7 @@ file_print_guid(char *str, size_t len, const uint64_t *guid)
g->data4[6], g->data4[7]);
@@ -888,5 +888,6 @@
}

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

protected char *
file_protected char *
file_strtrim(char *str)
--
2.29.2.windows.2
Expand Down
38 changes: 0 additions & 38 deletions ports/libmagic/0014-Define-POSIX-macros-if-missing.patch

This file was deleted.

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

-#ifdef FIONREAD
-#if defined(FIONREAD) && !defined(__MINGW32__)
+#if defined(FIONREAD) && !defined(__MINGW32__) && !defined(WIN32)
if (canbepipe && (ioctl(fd, FIONREAD, &t) == -1 || t == 0)) {
#ifdef FD_ZERO
Expand Down
1 change: 1 addition & 0 deletions ports/libmagic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ list(APPEND LIBMAGIC_SOURCE_FILES
${LIBMAGIC_SOURCE_DIR}/fsmagic.c
${LIBMAGIC_SOURCE_DIR}/funcs.c
${LIBMAGIC_SOURCE_DIR}/is_json.c
${LIBMAGIC_SOURCE_DIR}/is_simh.c
${LIBMAGIC_SOURCE_DIR}/is_tar.c
${LIBMAGIC_SOURCE_DIR}/magic.c
${LIBMAGIC_SOURCE_DIR}/print.c
Expand Down
6 changes: 2 additions & 4 deletions ports/libmagic/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,17 @@ if(VCPKG_TARGET_IS_WINDOWS)
"0006-Remove-Wrap-POSIX-headers.patch"
"0007-Substitute-unistd-macros-for-MSVC.patch"
"0008-Add-FILENO-defines.patch"
"0009-No-fcntl-in-magic.c.patch"
"0010-Properly-check-for-the-presence-of-bitmasks.patch"
"0011-Remove-pipe-related-functions-in-funcs.c.patch"
"0014-Define-POSIX-macros-if-missing.patch"
"0015-MSYS2-Remove-ioctl-call.patch"
)
endif()

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO file/file
REF FILE5_40
SHA512 d76bfe5326e1b40368e055c2e049a24b4ffdbd727371f4f3aa1dd3f53787d16b88550b3cc71ecf02151e2fb3e567eb2598e4707badab8c391eb71113c2dcc319
REF FILE5_45
SHA512 fdd4c5d13d5ea1d25686c76d8ebc3252c54040c4871e3f0f623c4548b3841795d4e36050292a9453eedf0fbf932573890e9d6ac9fa63ccf577215598ae84b9ea
HEAD_REF master
PATCHES ${PATCHES}
)
Expand Down
2 changes: 1 addition & 1 deletion ports/libmagic/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libmagic",
"version-string": "5.40",
"version-string": "5.45",
"port-version": 1,
"description": "This library can be used to classify files according to magic number tests.",
"homepage": "https://github.com/file/file",
Expand Down

0 comments on commit c44fb49

Please sign in to comment.