Skip to contentSkip to conversation

configure.ac: Improve check for magic

PATCH Superseded Mateusz Marciniec 2 participants 3 messages Aug 23, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure.ac: Improve check for magic

Check whether magic.h header exists before defining HAVE_MAGIC.

Despite library availability there still can be missing header. Current test doesn't cover that possibility which will lead compilation to fail in case of separate sysroot.

Upstream-Status: Accepted [expected in next release after 2.38.1]

---
 meta/recipes-core/util-linux/util-linux.inc   |  1 +
 ...configure.ac-Improve-check-for-magic.patch | 39 +++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch
meta/recipes-core/util-linux/util-linux.inc +1 -0
index 416550a6b2..3868b1c41d 100644
@@ -36,6 +36,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
            file://display_testname_for_subtest.patch \
            file://avoid_parallel_tests.patch \
            file://0001-check-for-sys-pidfd.h.patch \
+           file://0001-configure.ac-Improve-check-for-magic.patch \
            "
 
 SRC_URI[sha256sum] = "60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f"
meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch new file +39 -0
new file mode 100644
index 0000000000..0748e4cfb5
@@ -0,0 +1,39 @@
+From 263381ddd46eea2293c70bc811273b66bc52087b Mon Sep 17 00:00:00 2001
+From: Mateusz Marciniec <[email protected]>
+Date: Fri, 19 Aug 2022 14:47:49 +0200
+Subject: [PATCH] configure.ac: Improve check for magic
+
+Check whether magic.h header exists before defining HAVE_MAGIC.
+
+Despite library availability there still can be missing header.
+Current test doesn't cover that possibility which will lead compilation
+to fail in case of separate sysroot.
+
+Upstream-Status: Accepted [expected in next release after 2.38.1]
+
+Signed-off-by: Mateusz Marciniec <[email protected]>
+Signed-off-by: Tomasz Dziendzielski <[email protected]>
+---
+ configure.ac | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index daa8f0dca..968a0daf0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1570,8 +1570,10 @@ AC_ARG_WITH([libmagic],
+ )
+ AS_IF([test "x$with_libmagic" = xno], [have_magic=no], [
+   AC_CHECK_LIB([magic], [magic_open], [
+-    AC_DEFINE([HAVE_MAGIC], [1], [Define to 1 if you have the libmagic present.])
+-    MAGIC_LIBS="-lmagic"
++    AC_CHECK_HEADER(magic.h, [
++      AC_DEFINE([HAVE_MAGIC], [1], [Define to 1 if you have the libmagic present.])
++      MAGIC_LIBS="-lmagic"
++    ])
+   ])
+ ])
+ AC_SUBST([MAGIC_LIBS])
+-- 
+2.37.1
+
Signature · 1 line
2.37.2
#1 lore raw

Hi Mateusz,

Your commit title should have the recipe this applies to:

util-linux: Improve check for magic in configure.ac

for example.

Quoted 37 lines · Mateusz Marciniec

Check whether magic.h header exists before defining HAVE_MAGIC.

Despite library availability there still can be missing header. Current test doesn't cover that possibility which will lead compilation to fail in case of separate sysroot.

Upstream-Status: Accepted [expected in next release after 2.38.1]

---
  meta/recipes-core/util-linux/util-linux.inc   |  1 +
  ...configure.ac-Improve-check-for-magic.patch | 39 +++++++++++++++++++
  2 files changed, 40 insertions(+)

create mode 100644 meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch

meta/recipes-core/util-linux/util-linux.inc +1 -0
index 416550a6b2..3868b1c41d 100644
@@ -36,6 +36,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin
             file://display_testname_for_subtest.patch \
             file://avoid_parallel_tests.patch \
             file://0001-check-for-sys-pidfd.h.patch \
+           file://0001-configure.ac-Improve-check-for-magic.patch \
             "
 
  SRC_URI[sha256sum] = "60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f"
meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch new file +3 -0
new file mode 100644
index 0000000000..0748e4cfb5
@@ -0,0 +1,39 @@
+From 263381ddd46eea2293c70bc811273b66bc52087b Mon Sep 17 00:00:00 2001
+From: Mateusz Marciniec <[email protected]>
+Date: Fri, 19 Aug 2022 14:47:49 +0200

meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch line 13

Quoted 10 lines
meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch new file +10 -0
+Subject: [PATCH] configure.ac: Improve check for magic
+
+Check whether magic.h header exists before defining HAVE_MAGIC.
+
+Despite library availability there still can be missing header.
+Current test doesn't cover that possibility which will lead compilation
+to fail in case of separate sysroot.
+
+Upstream-Status: Accepted [expected in next release after 2.38.1]
+

This is a backport I would say, please use:
Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/263381ddd46eea2293c70bc811273b66bc52087b]

I assume the Accepted status would be for projects not using software version control (e.g. svn, git) where it's difficult to extract a simple patch. What comes to mind is ncurses project for example.

Not a biggie, but having at least the link would be very nice though :)

Cheers,
Quentin

#2 lore raw

Hello Quentin,

yes, my bad, I didn't notice that this commit title doesn't belong here. I will make changes according to your comments.
Thank you very much for your explanation :)

Best Regards,
Mateusz

wt., 23 sie 2022 o 13:25 Quentin Schulz <
[email protected]> napisał(a):

Quoted 78 lines

Hi Mateusz,

Your commit title should have the recipe this applies to:

util-linux: Improve check for magic in configure.ac

for example.

Quoted 8 lines · Mateusz Marciniec

Check whether magic.h header exists before defining HAVE_MAGIC.

Despite library availability there still can be missing header. Current test doesn't cover that possibility which will lead compilation to fail in case of separate sysroot.

Upstream-Status: Accepted [expected in next release after 2.38.1]

Quoted 7 lines
---
  meta/recipes-core/util-linux/util-linux.inc   |  1 +
  ...configure.ac-Improve-check-for-magic.patch | 39 +++++++++++++++++++
  2 files changed, 40 insertions(+)

create mode 100644

meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch

Review

Quoted 2 lines
(quoted diff) +0 -0

b/meta/recipes-core/util-linux/util-linux.inc

meta/recipes-core/util-linux/util-linux.inc SRC_URI =

Quoted 4 lines

index 416550a6b2..3868b1c41d 100644

meta/recipes-core/util-linux/util-linux.inc +0 -0
@@ -36,6 +36,7 @@ SRC_URI =

"${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin

meta/recipes-core/util-linux/util-linux.inc SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-lin

Quoted 7 lines
meta/recipes-core/util-linux/util-linux.inc +1 -0
             file://display_testname_for_subtest.patch \
             file://avoid_parallel_tests.patch \
             file://0001-check-for-sys-pidfd.h.patch \
+           file://0001-configure.ac-Improve-check-for-magic.patch \
             "
 
  SRC_URI[sha256sum] =

"60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f"

Quoted 1 line

diff --git

a/meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch b/meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch

Quoted 4 lines

new file mode 100644
index 0000000000..0748e4cfb5
--- /dev/null
+++

b/meta/recipes-core/util-linux/util-linux/0001-configure.ac-Improve-check-for-magic.patch

Quoted 4 lines
meta/recipes-core/util-linux/util-linux.inc +3 -0
@@ -0,0 +1,39 @@
+From 263381ddd46eea2293c70bc811273b66bc52087b Mon Sep 17 00:00:00 2001
+From: Mateusz Marciniec <[email protected]>
+Date: Fri, 19 Aug 2022 14:47:49 +0200

meta/recipes-core/util-linux/util-linux.inc line 13

Quoted 10 lines
meta/recipes-core/util-linux/util-linux.inc +10 -0
+Subject: [PATCH] configure.ac: Improve check for magic
+
+Check whether magic.h header exists before defining HAVE_MAGIC.
+
+Despite library availability there still can be missing header.
+Current test doesn't cover that possibility which will lead compilation
+to fail in case of separate sysroot.
+
+Upstream-Status: Accepted [expected in next release after 2.38.1]
+

This is a backport I would say, please use:
Upstream-Status: Backport
[
https://github.com/util-linux/util-linux/commit/263381ddd46eea2293c70bc811273b66bc52087b
]

I assume the Accepted status would be for projects not using software version control (e.g. svn, git) where it's difficult to extract a simple patch. What comes to mind is ncurses project for example.

Not a biggie, but having at least the link would be very nice though :)

Cheers,
Quentin