Skip to contentSkip to conversation

include sys/sysmacros.h for getting major() definition

PATCH In review Khem Raj 2 participants 10 messages Dec 18, 2016 – Dec 22, 2016

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 include sys/sysmacros.h for getting major() definition

glibc 2.25 has deprecated inclusion of <sys/sysmacros.h> by <sys/types.h>

---
 grub-core/osdep/linux/getroot.c | 2 +-
 grub-core/osdep/unix/getroot.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
grub-core/osdep/linux/getroot.c +1 -1
index 09e7e6e..5923d17 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
grub-core/osdep/unix/getroot.c +1 -1
index 4bf37b0..5aaa086 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
Signature · 1 line
1.9.1
#1 lore raw

18.12.2016 22:49, Khem Raj пишет:

Quoted 6 lines

glibc 2.25 has deprecated inclusion of <sys/sysmacros.h> by <sys/types.h>

---
 grub-core/osdep/linux/getroot.c | 2 +-
 grub-core/osdep/unix/getroot.c  | 2 +-

There are more files using major()

grub-core/osdep/linux/getroot.c line 23

Quoted 12 lines
 2 files changed, 2 insertions(+), 2 deletions(-)
grub-core/osdep/linux/getroot.c +1 -1
index 09e7e6e..5923d17 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>

We already do it:

#if defined(MAJOR_IN_MKDEV)
#include <sys/mkdev.h>
#elif defined(MAJOR_IN_SYSMACROS)
#include <sys/sysmacros.h>
#endif

If this check fails, please debug why it fails and fix check.

Quoted 17 lines
grub-core/osdep/linux/getroot.c +0 -0
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
grub-core/osdep/unix/getroot.c +1 -1
index 4bf37b0..5aaa086 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
author
#2 lore raw

Hi Andrei

Quoted 27 lines · Andrei Borzenkov

18.12.2016 22:49, Khem Raj пишет:

Quoted 6 lines

glibc 2.25 has deprecated inclusion of <sys/sysmacros.h> by <sys/types.h>

---
grub-core/osdep/linux/getroot.c | 2 +-
grub-core/osdep/unix/getroot.c | 2 +-

There are more files using major()

grub-core/osdep/linux/getroot.c line 23

Quoted 12 lines
2 files changed, 2 insertions(+), 2 deletions(-)
grub-core/osdep/linux/getroot.c +1 -1
index 09e7e6e..5923d17 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>

We already do it:

Quoted 8 lines

#if defined(MAJOR_IN_MKDEV)
#include <sys/mkdev.h>
#elif defined(MAJOR_IN_SYSMACROS)
#include <sys/sysmacros.h>
#endif

If this check fails, please debug why it fails and fix check.

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

grub is using AC_HEADER_MAJOR to find this out, however the check is failing AC_HEADER_MAJOR is unable to detect that these macros are
now spewing warning messages if sys/sysmacros.h is not included and this becomes an error with -Werror

Quoted 18 lines
Quoted 17 lines
grub-core/osdep/linux/getroot.c +0 -0
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
grub-core/osdep/unix/getroot.c +1 -1
index 4bf37b0..5aaa086 100644
@@ -20,7 +20,7 @@
 #include <config.h>
 
 #include <sys/stat.h>
-#include <sys/types.h>
+#include <sys/sysmacros.h>
 #include <assert.h>
 #include <fcntl.h>
 #include <unistd.h>
author
#4 lore raw
Quoted 14 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 6 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

Its big so instead I pasted it here
http://sprunge.us/DFBP <http://sprunge.us/DFBP>

#5 lore raw

18.12.2016 23:44, Khem Raj пишет:

Quoted 9 lines
Quoted 9 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 5 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

This should be fixed in autoconf commit e17a30e987d7ee695fb4294a82d987ec3dc9b974 which will be in 2.70. I do not know what plans there are to release it. Can you test if using current autoconf GIT fixes this? You will need to rebuild configure using updated autoconf.

author
#6 lore raw
Quoted 19 lines · Andrei Borzenkov

18.12.2016 23:44, Khem Raj пишет:

Quoted 9 lines
Quoted 9 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 5 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

Quoted 5 lines

This should be fixed in autoconf commit e17a30e987d7ee695fb4294a82d987ec3dc9b974 which will be in 2.70. I do not know what plans there are to release it. Can you test if using current autoconf GIT fixes this? You will need to rebuild configure using updated autoconf.

I backported that patch into 2.69 and this fixed the issue. This patch can be dropped since its not needed with 2.70+ and with the above back port for older autoconf.

#7 lore raw

19.12.2016 03:12, Khem Raj пишет:

Quoted 19 lines
Quoted 19 lines · Andrei Borzenkov

18.12.2016 23:44, Khem Raj пишет:

Quoted 14 lines
Quoted 14 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 6 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

Quoted 9 lines
Quoted 5 lines

This should be fixed in autoconf commit e17a30e987d7ee695fb4294a82d987ec3dc9b974 which will be in 2.70. I do not know what plans there are to release it. Can you test if using current autoconf GIT fixes this? You will need to rebuild configure using updated autoconf.

I backported that patch into 2.69 and this fixed the issue. This patch can be dropped since its not needed with 2.70+ and with the above back port for older autoconf.

We cannot really force everyone to use bleeding edge that is not even released. Could you please test attached patch with plain autoconf 2.69 or below?

From: Andrei Borzenkov <[email protected]>
Subject: [PATCH] configure: fix check for sys/sysmacros.h under glibc 2.25+

glibc 2.25 still includes sys/sysmacros.h in sys/types.h but also emits deprecation warning. So test for sys/types.h succeeds in configure but later compilation fails because we use -Werror by default.

While this is fixed in current autoconf GIT, we really cannot force everyone to use bleeding edge (that is not even released right now). So run test under -Werror as well to force proper detection.

This should have no impact on autoconf 2.70+ as AC_HEADER_MAJOR in this version simply checks for header existence.

Reported and tested by Khem Raj <[email protected]>

---
 configure.ac | 7 +++++++
 1 file changed, 7 insertions(+)
configure.ac +7 -0
index dc56564..4e980c5 100644
@@ -389,7 +389,14 @@ fi
 # Check for functions and headers.
 AC_CHECK_FUNCS(posix_memalign memalign getextmntent)
 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/mnttab.h limits.h)
+
+# glibc 2.25 still includes sys/sysmacros.h in sys/types.h but emits deprecation
+# warning which causes compilation failure later with -Werror. So use -Werror here
+# as well to force proper sys/sysmacros.h detection.
+SAVED_CFLAGS="$CFLAGS"
+CFLAGS="$HOST_CFLAGS -Werror"
 AC_HEADER_MAJOR
+CFLAGS="$SAVED_CFLAGS"
 
 AC_CHECK_MEMBERS([struct statfs.f_fstypename],,,[$ac_includes_default
 #include <sys/param.h>
Signature · 1 line
tg: (ce95549..) u/glibc-2.25-header_major (depends on: master)
author
#8 lore raw
Quoted 29 lines · Andrei Borzenkov

19.12.2016 03:12, Khem Raj пишет:

Quoted 25 lines
Quoted 24 lines · Andrei Borzenkov

18.12.2016 23:44, Khem Raj пишет:

Quoted 9 lines
Quoted 9 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 5 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

This should be fixed in autoconf commit e17a30e987d7ee695fb4294a82d987ec3dc9b974 which will be in 2.70. I do not know what plans there are to release it. Can you test if using current autoconf GIT fixes this? You will need to rebuild configure using updated autoconf.

Quoted 8 lines
Quoted 3 lines

I backported that patch into 2.69 and this fixed the issue. This patch can be dropped since its not needed with 2.70+ and with the above back port for older autoconf.

We cannot really force everyone to use bleeding edge that is not even released. Could you please test attached patch with plain autoconf 2.69 or below?
<glibc-2.25-header_major.patch>

This seemed to work in my environment.

#9 lore raw

20.12.2016 23:13, Khem Raj пишет:

Quoted 33 lines
Quoted 33 lines · Andrei Borzenkov

19.12.2016 03:12, Khem Raj пишет:

Quoted 28 lines
Quoted 19 lines · Andrei Borzenkov

18.12.2016 23:44, Khem Raj пишет:

Quoted 9 lines
Quoted 9 lines · Andrei Borzenkov

18.12.2016 23:38, Khem Raj пишет:

Quoted 5 lines

Thanks for your review. On further investigation the issue seems to be autoconf related
with commit
http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c <http://git.savannah.gnu.org/cgit/grub.git/commit/?id=7a5b301e3adb8e054288518a325135a1883c1c6c>

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

grub is using AC_HEADER_MAJOR to find this out, however the check is failing

Please attach config.log.

Quoted 5 lines

This should be fixed in autoconf commit e17a30e987d7ee695fb4294a82d987ec3dc9b974 which will be in 2.70. I do not know what plans there are to release it. Can you test if using current autoconf GIT fixes this? You will need to rebuild configure using updated autoconf.

I backported that patch into 2.69 and this fixed the issue. This patch can be dropped since its not needed with 2.70+ and with the above back port for older autoconf.

Quoted 7 lines
Quoted 4 lines

We cannot really force everyone to use bleeding edge that is not even released. Could you please test attached patch with plain autoconf 2.69 or below?
<glibc-2.25-header_major.patch>

This seemed to work in my environment.

Committed. Thanks!