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

Message ID 1482090557-15453-1-git-send-email-raj.khem@gmail.com
State New
Headers show

Commit Message

Khem Raj Dec. 18, 2016, 7:49 p.m.
glibc 2.25 has deprecated inclusion of <sys/sysmacros.h> by <sys/types.h>

Signed-off-by: Khem Raj <raj.khem@gmail.com>

---
 grub-core/osdep/linux/getroot.c | 2 +-
 grub-core/osdep/unix/getroot.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
1.9.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Comments

Andrei Borzenkov Dec. 18, 2016, 8:11 p.m. | #1
18.12.2016 22:49, Khem Raj пишет:
> glibc 2.25 has deprecated inclusion of <sys/sysmacros.h> by <sys/types.h>
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  grub-core/osdep/linux/getroot.c | 2 +-
>  grub-core/osdep/unix/getroot.c  | 2 +-

There are more files using major()

>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
> index 09e7e6e..5923d17 100644
> --- a/grub-core/osdep/linux/getroot.c
> +++ b/grub-core/osdep/linux/getroot.c
> @@ -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.

>  #include <assert.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
> index 4bf37b0..5aaa086 100644
> --- a/grub-core/osdep/unix/getroot.c
> +++ b/grub-core/osdep/unix/getroot.c
> @@ -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>
>
Khem Raj Dec. 18, 2016, 8:38 p.m. | #2
Hi Andrei

> On Dec 18, 2016, at 12:11 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:

> 

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

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

>> 

>> Signed-off-by: Khem Raj <raj.khem@gmail.com>

>> ---

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

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

> 

> There are more files using major()

> 

>> 2 files changed, 2 insertions(+), 2 deletions(-)

>> 

>> diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c

>> index 09e7e6e..5923d17 100644

>> --- a/grub-core/osdep/linux/getroot.c

>> +++ b/grub-core/osdep/linux/getroot.c

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

> 


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


>> #include <assert.h>

>> #include <fcntl.h>

>> #include <unistd.h>

>> diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c

>> index 4bf37b0..5aaa086 100644

>> --- a/grub-core/osdep/unix/getroot.c

>> +++ b/grub-core/osdep/unix/getroot.c

>> @@ -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-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Andrei Borzenkov Dec. 18, 2016, 8:41 p.m. | #3
18.12.2016 23:38, Khem Raj пишет:
> 
> 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.
Khem Raj Dec. 18, 2016, 8:44 p.m. | #4
> On Dec 18, 2016, at 12:41 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:

> 

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

>> 

>> 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>
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Andrei Borzenkov Dec. 18, 2016, 8:57 p.m. | #5
18.12.2016 23:44, Khem Raj пишет:
> 
>> On Dec 18, 2016, at 12:41 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:
>>
>> 18.12.2016 23:38, Khem Raj пишет:
>>>
>>> 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.
>>
>>

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.
Khem Raj Dec. 19, 2016, 12:12 a.m. | #6
> On Dec 18, 2016, at 12:57 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:

> 

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

>> 

>>> On Dec 18, 2016, at 12:41 PM, Andrei Borzenkov <arvidjaar@gmail.com> wrote:

>>> 

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

>>>> 

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

>>> 

>>> 

> 

> 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.
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Patch hide | download patch | download mbox

diff --git a/grub-core/osdep/linux/getroot.c b/grub-core/osdep/linux/getroot.c
index 09e7e6e..5923d17 100644
--- a/grub-core/osdep/linux/getroot.c
+++ b/grub-core/osdep/linux/getroot.c
@@ -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>
diff --git a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c
index 4bf37b0..5aaa086 100644
--- a/grub-core/osdep/unix/getroot.c
+++ b/grub-core/osdep/unix/getroot.c
@@ -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>