Skip to content

Commit

Permalink
Update the libmagic vcpkg port overlay to version 5.45. (#5332) (#5418)
Browse files Browse the repository at this point in the history
Backport #5332 to release-2.26 to fix
conda-forge/tiledb-feedstock#399

---


[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.

(cherry picked from commit c44fb49)

<long description>

---
TYPE: NO_HISTORY | FEATURE | BUG | IMPROVEMENT | DEPRECATION | C_API |
CPP_API | BREAKING_BEHAVIOR | BREAKING_API | FORMAT
DESC: <short description>

---------

Co-authored-by: Theodore Tsirpanis <[email protected]>
  • Loading branch information
ihnorton and teo-tsirpanis authored Jan 7, 2025
1 parent 43ad92f commit 69ef84e
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 108 deletions.
21 changes: 10 additions & 11 deletions .github/workflows/full-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,16 @@ jobs:
timeout: 120
bootstrap_args: '--enable-azure'

ci_manylinux:
uses: ./.github/workflows/ci-linux_mac.yml
with:
ci_backend: MANYLINUX
matrix_image: ubuntu-20.04
matrix_compiler_cflags: "-lrt"
matrix_compiler_cxxflags: "-lrt"
timeout: 120
bootstrap_args: '--enable-serialization'
manylinux: true
#ci_manylinux:
# uses: ./.github/workflows/ci-linux_mac.yml
# with:
# ci_backend: MANYLINUX
# matrix_image: ubuntu-20.04
# matrix_compiler_cflags: "-lrt"
# matrix_compiler_cxxflags: "-lrt"
# timeout: 120
# bootstrap_args: '--enable-serialization'
# manylinux: true

ci_msvc:
uses: ./.github/workflows/build-windows.yml
Expand Down Expand Up @@ -145,7 +145,6 @@ jobs:
ci7,
ci8,
ci9,
ci_manylinux,
ci_msvc,
backward_compatibility,
standalone
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ jobs:
- platform: windows-x86_64
os: windows-2019
triplet: x64-windows-release
- platform: linux-x86_64
os: ubuntu-20.04
manylinux: true
triplet: x64-linux-release
- platform: linux-x86_64-noavx2
os: ubuntu-20.04
cmake_args: -DCOMPILER_SUPPORTS_AVX2=OFF
triplet: x64-linux-release
manylinux: true
#- platform: linux-x86_64
# os: ubuntu-20.04
# manylinux: true
# triplet: x64-linux-release
#- platform: linux-x86_64-noavx2
# os: ubuntu-20.04
# cmake_args: -DCOMPILER_SUPPORTS_AVX2=OFF
# triplet: x64-linux-release
# manylinux: true
- platform: macos-x86_64
os: macos-12
MACOSX_DEPLOYMENT_TARGET: 11
Expand Down
2 changes: 1 addition & 1 deletion ports/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +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. |
| `libmagic` | Using a custom CMake-based port that is not accepted upstream. |
| `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). |
| `libfaketime` | Port does not yet exist upstream |
Expand Down
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 69ef84e

Please sign in to comment.