Skip to contentSkip to conversation

package/e2fsprogs: backport build fix for rhel5 due to missing magic

PATCH New Max Filippov 3 participants 10 messages Nov 9, 2016 – Nov 16, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

Backported from: b003b2e6f9e54e7b2bde15828b97f5dc285b915e

---
 ...fix-compilation-on-RHEL-5.x-due-to-missin.patch | 45 ++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 package/e2fsprogs/0003-libsupport-fix-compilation-on-RHEL-5.x-due-to-missin.patch
package/e2fsprogs/0003-libsupport-fix-compilation-on-RHEL-5.x-due-to-missin.patch new file +45 -0
new file mode 100644
index 0000000..3569a3a
@@ -0,0 +1,45 @@
+From b003b2e6f9e54e7b2bde15828b97f5dc285b915e Mon Sep 17 00:00:00 2001
+From: Thomas De Schampheleire <[email protected]>
+Date: Tue, 25 Oct 2016 13:22:39 -0400
+Subject: [PATCH] libsupport: fix compilation on RHEL 5.x due to missing magic
+ define
+
+RHEL 5.x does have magic.h, but it does not define all expected symbols. In
+particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x
+is using 4.17.
+
+Add substitute defines to allow continued usage of magic but without the
+requested exclude checks.
+
+Signed-off-by: Thomas De Schampheleire <[email protected]>
+Signed-off-by: Theodore Ts'o <[email protected]>
+Signed-off-by: Max Filippov <[email protected]>
+---
+ lib/support/plausible.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/lib/support/plausible.c b/lib/support/plausible.c
+index 6f0c4bc..0636061 100644
+--- a/lib/support/plausible.c
++++ b/lib/support/plausible.c
+@@ -43,6 +43,17 @@ static const char *(*dl_magic_file)(magic_t, const char *);
+ static int (*dl_magic_load)(magic_t, const char *);
+ static void (*dl_magic_close)(magic_t);
+ 
++/*
++ * NO_CHECK functionality was only added in file 4.20.
++ * Older systems like RHEL 5.x still have file 4.17
++ */
++#ifndef MAGIC_NO_CHECK_COMPRESS
++#define MAGIC_NO_CHECK_COMPRESS 0x0001000
++#endif
++#ifndef MAGIC_NO_CHECK_ELF
++#define MAGIC_NO_CHECK_ELF 0x0010000
++#endif
++
+ #ifdef HAVE_DLOPEN
+ #include <dlfcn.h>
+ 
+-- 
+2.1.4
+
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hi Max,

Quoted 3 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Instead of relying on host libmagic that may or may not be installed, why not add host-file to HOST_E2FSPROGS_DEPENDENCIES?

Quoted 4 lines

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

Backported from: b003b2e6f9e54e7b2bde15828b97f5dc285b915e

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hi Baruch,

Quoted 7 lines · Baruch Siach
Quoted 3 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Instead of relying on host libmagic that may or may not be installed, why not add host-file to HOST_E2FSPROGS_DEPENDENCIES?

My first reaction was to look if the issue is addressed in the package mainline, and that's how e2fsprogs mainline decided to deal with that. So the next version bump of e2fsprogs will make host-libmagic not necessary, there's probably no reason to introduce that dependency?

"libmagic installed" vs. "not installed" is handled well by e2fsprogs, it's "installed, but too old" case that fails.

Signature · 2 lines
Thanks.
-- Max
#3 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hi Max,

Quoted 9 lines · Max Filippov
Quoted 7 lines · Baruch Siach
Quoted 3 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Instead of relying on host libmagic that may or may not be installed, why not add host-file to HOST_E2FSPROGS_DEPENDENCIES?

Quoted 7 lines

My first reaction was to look if the issue is addressed in the package mainline, and that's how e2fsprogs mainline decided to deal with that. So the next version bump of e2fsprogs will make host-libmagic not necessary, there's probably no reason to introduce that dependency?

"libmagic installed" vs. "not installed" is handled well by e2fsprogs, it's "installed, but too old" case that fails.

We would generally like to avoid dependency on host libraries as much as possible since it reduces the build reproducibility. But as this is just a host tool I'm not sure we care.

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
#4 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hello,

Quoted 15 lines · Baruch Siach
Quoted 14 lines · Max Filippov
Quoted 7 lines · Baruch Siach
Quoted 3 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Instead of relying on host libmagic that may or may not be installed, why not add host-file to HOST_E2FSPROGS_DEPENDENCIES?

My first reaction was to look if the issue is addressed in the package mainline, and that's how e2fsprogs mainline decided to deal with that. So the next version bump of e2fsprogs will make host-libmagic not necessary, there's probably no reason to introduce that dependency?

Quoted 6 lines
Quoted 2 lines

"libmagic installed" vs. "not installed" is handled well by e2fsprogs, it's "installed, but too old" case that fails.

We would generally like to avoid dependency on host libraries as much as possible since it reduces the build reproducibility. But as this is just a host tool I'm not sure we care.

We do care.

So in this case, it would be better (if possible) to completely disable the use of libmagic by host-e2fsprogs. This way, the behavior is consistent on both machines that have libmagic installed and those who don't.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#5 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

In reply to Max Filippov

Hello,

Quoted 10 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

Backported from: b003b2e6f9e54e7b2bde15828b97f5dc285b915e

Can you try:

E2FSPROGS_CONF_ENV += \
	ac_cv_header_magic_h=no \

ac_cv_lib_magic_magic_file=no

instead of this patch?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#6 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hi Thomas,

Quoted 12 lines · Thomas Petazzoni
Quoted 10 lines · Max Filippov

RHEL 5.x does have magic.h, but it does not define all expected symbols. In particular, the NO_CHECK symbols were only added in file 4.20 and RHEL 5.x is using 4.17.

Add substitute defines to allow continued usage of magic but without the requested exclude checks.

Backported from: b003b2e6f9e54e7b2bde15828b97f5dc285b915e

Quoted 7 lines

Can you try:

E2FSPROGS_CONF_ENV += \
	ac_cv_header_magic_h=no \

ac_cv_lib_magic_magic_file=no

instead of this patch?

Do you mean HOST_E2FSPROGS_CONF_ENV?

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#7 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hello,

Quoted 7 lines · Baruch Siach
Quoted 5 lines
E2FSPROGS_CONF_ENV += \
	ac_cv_header_magic_h=no \

ac_cv_lib_magic_magic_file=no

instead of this patch?

Do you mean HOST_E2FSPROGS_CONF_ENV?

Yes, indeed, it's for the host variant of the package.

Thanks for correcting me on this,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#8 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Quoted 6 lines · Thomas Petazzoni
Quoted 4 lines · Baruch Siach
Quoted 4 lines
E2FSPROGS_CONF_ENV += \
    ac_cv_header_magic_h=no \
    ac_cv_lib_magic_magic_file=no
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

instead of this patch?

Do you mean HOST_E2FSPROGS_CONF_ENV?

Yes, indeed, it's for the host variant of the package.

Thanks for correcting me on this,

Works for me, thank you.

Signature · 2 lines
Thanks.
-- Max
#9 lore raw

PATCH 1/1 package/e2fsprogs: backport build fix for rhel5 due to missing magic

Hello,

Quoted 6 lines · Max Filippov
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
E2FSPROGS_CONF_ENV += \
    ac_cv_header_magic_h=no \
    ac_cv_lib_magic_magic_file=no

instead of this patch?

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Do you mean HOST_E2FSPROGS_CONF_ENV?

Yes, indeed, it's for the host variant of the package.

Thanks for correcting me on this,

Works for me, thank you.

Great, could you send a proper patch that implements this solution then?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com