[1/1] coreutils: fix statx failure on native builds

Message ID 373dcd3613b74ba10dba54f5116576bc172c222f.1646119426.git.liezhi.yang@windriver.com
State New
Headers show
Series [1/1] coreutils: fix statx failure on native builds | expand

Commit Message

Robert Yang March 1, 2022, 7:24 a.m. UTC
From: Davi Poyastro <davi.poyastro@nokia.com>

Coreutils configure only checks glibc compatibility for statx
syscall but fail to check kernel support.

Fixed on RedHat Enterprise Linux Server 7.6 (Maipo)
Host kernel: 3.10.0-1127.8.2.el7.x86_64
Docker distro: Ubuntu 20.04.1 LTS

$ bitbake coreutils-native
find the binary ls and run it as "ls -l ."
The result is something like: "?????????. ? ? ? ? ? foo"

Signed-off-by: Davi Poyastro <davi.poyastro@nokia.com>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/recipes-core/coreutils/coreutils_9.0.bb | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Richard Purdie March 1, 2022, 7:59 a.m. UTC | #1
On Mon, 2022-02-28 at 23:24 -0800, Robert Yang wrote:
> From: Davi Poyastro <davi.poyastro@nokia.com>
> 
> Coreutils configure only checks glibc compatibility for statx
> syscall but fail to check kernel support.
> 
> Fixed on RedHat Enterprise Linux Server 7.6 (Maipo)
> Host kernel: 3.10.0-1127.8.2.el7.x86_64
> Docker distro: Ubuntu 20.04.1 LTS
> 
> $ bitbake coreutils-native
> find the binary ls and run it as "ls -l ."
> The result is something like: "?????????. ? ? ? ? ? foo"
> 
> Signed-off-by: Davi Poyastro <davi.poyastro@nokia.com>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/recipes-core/coreutils/coreutils_9.0.bb | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
> index e4633949f42..40fad72bbf4 100644
> --- a/meta/recipes-core/coreutils/coreutils_9.0.bb
> +++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
> @@ -152,6 +152,11 @@ ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
>  ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
>  
>  python __anonymous() {
> +    from distutils.version import LooseVersion
> +    # statx syscall require glibc >= 2.28 and linux kernel >= 4.11
> +    if LooseVersion(os.uname().release) < LooseVersion('4.11'):
> +        d.appendVar("EXTRA_OECONF_class-native", " ac_cv_func_statx=0")
> +

Shouldn't that be EXTRA_OECONF:class-native?

Which makes me worry about where this was tested/needed?

I'm then a bit worried we have two different signatures for coreutils-native
depending upon which host this runs on, which will cause a number of other
issues. I don't think we can do this.

Cheers,

Richard
Robert Yang March 1, 2022, 8:19 a.m. UTC | #2
On 3/1/22 3:59 PM, Richard Purdie wrote:
> On Mon, 2022-02-28 at 23:24 -0800, Robert Yang wrote:
>> From: Davi Poyastro <davi.poyastro@nokia.com>
>>
>> Coreutils configure only checks glibc compatibility for statx
>> syscall but fail to check kernel support.
>>
>> Fixed on RedHat Enterprise Linux Server 7.6 (Maipo)
>> Host kernel: 3.10.0-1127.8.2.el7.x86_64
>> Docker distro: Ubuntu 20.04.1 LTS
>>
>> $ bitbake coreutils-native
>> find the binary ls and run it as "ls -l ."
>> The result is something like: "?????????. ? ? ? ? ? foo"
>>
>> Signed-off-by: Davi Poyastro <davi.poyastro@nokia.com>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   meta/recipes-core/coreutils/coreutils_9.0.bb | 5 +++++
>>   1 file changed, 5 insertions(+)
>>
>> diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
>> index e4633949f42..40fad72bbf4 100644
>> --- a/meta/recipes-core/coreutils/coreutils_9.0.bb
>> +++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
>> @@ -152,6 +152,11 @@ ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
>>   ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
>>   
>>   python __anonymous() {
>> +    from distutils.version import LooseVersion
>> +    # statx syscall require glibc >= 2.28 and linux kernel >= 4.11
>> +    if LooseVersion(os.uname().release) < LooseVersion('4.11'):
>> +        d.appendVar("EXTRA_OECONF_class-native", " ac_cv_func_statx=0")
>> +
> 
> Shouldn't that be EXTRA_OECONF:class-native?

Yes, you're right, I took this patch from hardknott and built it, but didn't 
realize that I need change the override syntax.

> 
> Which makes me worry about where this was tested/needed?
> 
> I'm then a bit worried we have two different signatures for coreutils-native
> depending upon which host this runs on, which will cause a number of other
> issues. I don't think we can do this.

That's a problem, maybe we need disable statx for coreutils-native?

The errors happens when glibc has a higher version (Ubuntu 20.04 in docker) 
which has statx(), but kernel version is low (CentOS 7) which doesn't support
statx.

// Robert

> 
> Cheers,
> 
> Richard
>
Richard Purdie March 1, 2022, 8:21 a.m. UTC | #3
On Tue, 2022-03-01 at 16:19 +0800, Robert Yang wrote:
> 
> On 3/1/22 3:59 PM, Richard Purdie wrote:
> > On Mon, 2022-02-28 at 23:24 -0800, Robert Yang wrote:
> > > From: Davi Poyastro <davi.poyastro@nokia.com>
> > > 
> > > Coreutils configure only checks glibc compatibility for statx
> > > syscall but fail to check kernel support.
> > > 
> > > Fixed on RedHat Enterprise Linux Server 7.6 (Maipo)
> > > Host kernel: 3.10.0-1127.8.2.el7.x86_64
> > > Docker distro: Ubuntu 20.04.1 LTS
> > > 
> > > $ bitbake coreutils-native
> > > find the binary ls and run it as "ls -l ."
> > > The result is something like: "?????????. ? ? ? ? ? foo"
> > > 
> > > Signed-off-by: Davi Poyastro <davi.poyastro@nokia.com>
> > > Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> > > ---
> > >   meta/recipes-core/coreutils/coreutils_9.0.bb | 5 +++++
> > >   1 file changed, 5 insertions(+)
> > > 
> > > diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
> > > index e4633949f42..40fad72bbf4 100644
> > > --- a/meta/recipes-core/coreutils/coreutils_9.0.bb
> > > +++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
> > > @@ -152,6 +152,11 @@ ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
> > >   ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
> > >   
> > >   python __anonymous() {
> > > +    from distutils.version import LooseVersion
> > > +    # statx syscall require glibc >= 2.28 and linux kernel >= 4.11
> > > +    if LooseVersion(os.uname().release) < LooseVersion('4.11'):
> > > +        d.appendVar("EXTRA_OECONF_class-native", " ac_cv_func_statx=0")
> > > +
> > 
> > Shouldn't that be EXTRA_OECONF:class-native?
> 
> Yes, you're right, I took this patch from hardknott and built it, but didn't 
> realize that I need change the override syntax.
> 
> > 
> > Which makes me worry about where this was tested/needed?
> > 
> > I'm then a bit worried we have two different signatures for coreutils-native
> > depending upon which host this runs on, which will cause a number of other
> > issues. I don't think we can do this.
> 
> That's a problem, maybe we need disable statx for coreutils-native?
> 
> The errors happens when glibc has a higher version (Ubuntu 20.04 in docker) 
> which has statx(), but kernel version is low (CentOS 7) which doesn't support
> statx.

Disabling it unconditionally which a comment about the version issues may be the
only option we have. I'm not sure everyone will like that but if we want to
support that combination, I'm not sure we have much choice.

Cheers,

Richard
Robert Yang March 1, 2022, 8:28 a.m. UTC | #4
On 3/1/22 4:21 PM, Richard Purdie wrote:
> On Tue, 2022-03-01 at 16:19 +0800, Robert Yang wrote:
>>
>> On 3/1/22 3:59 PM, Richard Purdie wrote:
>>> On Mon, 2022-02-28 at 23:24 -0800, Robert Yang wrote:
>>>> From: Davi Poyastro <davi.poyastro@nokia.com>
>>>>
>>>> Coreutils configure only checks glibc compatibility for statx
>>>> syscall but fail to check kernel support.
>>>>
>>>> Fixed on RedHat Enterprise Linux Server 7.6 (Maipo)
>>>> Host kernel: 3.10.0-1127.8.2.el7.x86_64
>>>> Docker distro: Ubuntu 20.04.1 LTS
>>>>
>>>> $ bitbake coreutils-native
>>>> find the binary ls and run it as "ls -l ."
>>>> The result is something like: "?????????. ? ? ? ? ? foo"
>>>>
>>>> Signed-off-by: Davi Poyastro <davi.poyastro@nokia.com>
>>>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>>>> ---
>>>>    meta/recipes-core/coreutils/coreutils_9.0.bb | 5 +++++
>>>>    1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
>>>> index e4633949f42..40fad72bbf4 100644
>>>> --- a/meta/recipes-core/coreutils/coreutils_9.0.bb
>>>> +++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
>>>> @@ -152,6 +152,11 @@ ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
>>>>    ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
>>>>    
>>>>    python __anonymous() {
>>>> +    from distutils.version import LooseVersion
>>>> +    # statx syscall require glibc >= 2.28 and linux kernel >= 4.11
>>>> +    if LooseVersion(os.uname().release) < LooseVersion('4.11'):
>>>> +        d.appendVar("EXTRA_OECONF_class-native", " ac_cv_func_statx=0")
>>>> +
>>>
>>> Shouldn't that be EXTRA_OECONF:class-native?
>>
>> Yes, you're right, I took this patch from hardknott and built it, but didn't
>> realize that I need change the override syntax.
>>
>>>
>>> Which makes me worry about where this was tested/needed?
>>>
>>> I'm then a bit worried we have two different signatures for coreutils-native
>>> depending upon which host this runs on, which will cause a number of other
>>> issues. I don't think we can do this.
>>
>> That's a problem, maybe we need disable statx for coreutils-native?
>>
>> The errors happens when glibc has a higher version (Ubuntu 20.04 in docker)
>> which has statx(), but kernel version is low (CentOS 7) which doesn't support
>> statx.
> 
> Disabling it unconditionally which a comment about the version issues may be the
> only option we have. I'm not sure everyone will like that but if we want to
> support that combination, I'm not sure we have much choice.

It's worth trying for deterministic build, and we only disable coreutils-native,
I will send a patch for it.

// Robert

> 
> Cheers,
> 
> Richard
>

Patch

diff --git a/meta/recipes-core/coreutils/coreutils_9.0.bb b/meta/recipes-core/coreutils/coreutils_9.0.bb
index e4633949f42..40fad72bbf4 100644
--- a/meta/recipes-core/coreutils/coreutils_9.0.bb
+++ b/meta/recipes-core/coreutils/coreutils_9.0.bb
@@ -152,6 +152,11 @@  ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
 ALTERNATIVE_LINK_NAME[stat.1] = "${mandir}/man1/stat.1"
 
 python __anonymous() {
+    from distutils.version import LooseVersion
+    # statx syscall require glibc >= 2.28 and linux kernel >= 4.11
+    if LooseVersion(os.uname().release) < LooseVersion('4.11'):
+        d.appendVar("EXTRA_OECONF_class-native", " ac_cv_func_statx=0")
+
     for prog in d.getVar('base_bindir_progs').split():
         d.setVarFlag('ALTERNATIVE_LINK_NAME', prog, '%s/%s' % (d.getVar('base_bindir'), prog))