Skip to contentSkip to conversation

e2fsprogs: add packageconfig for -file-

PATCH Superseded Randy MacLeod 4 participants 8 messages Sep 17, 2016 – Sep 19, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 e2fsprogs: add packageconfig for -file-

Without a packageconfig dependency for the file utility, there's a very rare compile faiure caused by a race where the magic.h header file is not found:

../../../git/lib/support/plausible.c:33:19: fatal error: magic.h: No such file or directory

This file, plausible.c, is part of libsupport.a which is used by many binaries produced by the e2fsprogs package. plausible.c attempts to dynamically load libmagic.so if the e2fsprogs configure detects that magic was available. Adding the packageconfig will eliminate the build as well as the possible configure-time race condition.

---
 meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +1 -0
index f4855bc..1707cb9 100644
@@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
 EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
 
 PACKAGECONFIG ??= ""
+PACKAGECONFIG[file] = ',,file'
 PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'
 
 do_configure_prepend () {
Signature · 1 line
1.9.1
#1 lore raw
Quoted 24 lines · Randy MacLeod

Without a packageconfig dependency for the file utility, there's a very rare compile faiure caused by a race where the magic.h header file is not found:

../../../git/lib/support/plausible.c:33:19: fatal error: magic.h: No
such file or directory

This file, plausible.c, is part of libsupport.a which is used by many binaries produced by the e2fsprogs package. plausible.c attempts to dynamically load libmagic.so if the e2fsprogs configure detects that magic was available. Adding the packageconfig will eliminate the build as well as the possible configure-time race condition.

---
 meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +0 -0
index f4855bc..1707cb9 100644

meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb EXTRA_OECONF += "--libdir=${base_libdir} · line 27

Quoted 7 lines
meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb +1 -2
@@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
--sbindir=${base_sbindir} \
 EXTRA_OECONF_darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir}
--enable-bsd-shlibs"
 
 PACKAGECONFIG ??= ""
+PACKAGECONFIG[file] = ',,file'
 

This isn’t going to be good enough. You aren’t explicitly enabling/disabling the option, so it’ll still detect based on what’s in the sysroot, so recipe build order will result in non-deterministic behavior.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 42 lines · Christopher Larson

On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    Without a packageconfig dependency for the file utility, there's
    a very rare compile faiure caused by a race where the magic.h
    header file is not found:

     ../../../git/lib/support/plausible.c:33:19: fatal error: magic.h:
    No such file or directory

    This file, plausible.c, is part of libsupport.a which is used by
    many binaries produced by the e2fsprogs package. plausible.c attempts
    to dynamically load libmagic.so if the e2fsprogs configure detects
    that magic was available. Adding the packageconfig will eliminate
    the build as well as the possible configure-time race condition.

    Signed-off-by: Randy MacLeod <[email protected]
    <mailto:[email protected]>>
    ---
     meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb> | 1 +
     1 file changed, 1 insertion(+)

    diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    index f4855bc..1707cb9 100644
    --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
    --sbindir=${base_sbindir} \
     EXTRA_OECONF_darwin = "--libdir=${base_libdir}
    --sbindir=${base_sbindir} --enable-bsd-shlibs"

     PACKAGECONFIG ??= ""
    +PACKAGECONFIG[file] = ',,file'
Quoted 4 lines

This isn’t going to be good enough. You aren’t explicitly enabling/disabling the option, so it’ll still detect based on what’s in the sysroot, so recipe build order will result in non-deterministic behavior.

Hi Christopher,

Thanks for the response but I don't understand. I'm probably wrong so please explain.
It seems that you're suggesting that I add:
--with[out]-magic to e2fsprogs configure, and while
I could do that, it does not seem to be needed.

Short response:

This change forces 'file' to be built before e2fsprogs if 'file' is present in the image or world build. Then e2fsprogs will detect magic.h,libmagic.so and the race is eliminated.

The details:

Note, that I thought this was a rare race condition but it showed up again yesterday in a work-related build.

It seems to work when I tested it and there are several other examples of using:
PACKAGECONFIG[foo] = ",,foo,"
such as:
meta/recipes-devtools/python/python-smartpm_git.bb

   GTK_RDEP = "${PN}-interface-gtk"
   ...
   PACKAGECONFIG[gtk] = ",,gtk+,${GTK_RDEP}"

and 38 others:

$ grep -r PACKAGECONFIG meta/recipes* | \
     grep ",,"| grep -v with | grep -v ",,," | wc -l
38

Also from:
meta/classes/base.bbclass
The PACKAGEDEPENDS handling code looks at:

        for flag, flagval in sorted(pkgconfigflags.items()):
            items = flagval.split(",")
            num = len(items)
            if num > 4:
                ...

            if flag in pkgconfig:
                if num >= 3 and items[2]:
                    extradeps.append(items[2])

In my case, num = 3 and file gets added to the depends and therefore built first. Then when e2fsprogs is built, the configure script auto-detects that file and libmagic are present (without risk of a race) and sets the magic flags as shown below. If there were a configure flag, I'd be happy to use it but from e2fsprogs's configure.ac:

dnl
dnl See if libmagic exists
dnl
AC_CHECK_LIB(magic, magic_file, [MAGIC_LIB=-lmagic AC_CHECK_HEADERS([magic.h])])
if test "$ac_cv_func_dlopen" = yes ; then
MAGIC_LIB=$DLOPEN_LIB
fi
AC_SUBST(MAGIC_LIB)
dnl

so even with my limited exposure to the autotools syntax, it seems like there's no: --with[out]-libmagic=yes option, right?

Some logs:

# No patch:

$ grep -i magic /tmp/e2fsprogs-no-patch-cleanall-file-config.log

configure:13035: checking for magic_file in -lmagic
configure:13060: x86_64-oe-linux-gcc <flags> \
conftest.c -lmagic -lblkid >&5
/.../tmp-glibc/sysroots/x86_64-linux/usr/libexec/x86_64-oe-linux/gcc/x86_64-oe-linux/6.2.0/ld: cannot find -lmagic | char magic_file ();
| return magic_file ();
ac_cv_lib_magic_magic_file=no
MAGIC_LIB='-ldl'

# with patch:
$ grep -i magic /tmp/e2fsprogs-with-patch-cim-config.log
g'
configure:13035: checking for magic_file in -lmagic
configure:13060: x86_64-oe-linux-gcc <flags> \
    conftest.c -lmagic  -lblkid  >&5
configure:13075: checking magic.h usability
configure:13075: checking magic.h presence
configure:13075: checking for magic.h
| #define HAVE_MAGIC_H 1
ac_cv_header_magic_h=yes
ac_cv_lib_magic_magic_file=yes
MAGIC_LIB='-ldl'
#define HAVE_MAGIC_H 1

Granted this doens't prove that the race went away.
[1]

$ cd .../e2fsprogs.git
$ git pull
$ grep magic ./configure
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for magic_file in -lmagic" >&5
$as_echo_n "checking for magic_file in -lmagic... " >&6; }
if ${ac_cv_lib_magic_magic_file+:} false; then :
LIBS="-lmagic  $LIBS"
char magic_file ();
return magic_file ();
  ac_cv_lib_magic_magic_file=yes
  ac_cv_lib_magic_magic_file=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_magic_magic_file" >&5
$as_echo "$ac_cv_lib_magic_magic_file" >&6; }
if test "x$ac_cv_lib_magic_magic_file" = xyes; then :
  MAGIC_LIB=-lmagic
for ac_header in magic.h
  ac_fn_c_check_header_mongrel "$LINENO" "magic.h" 
"ac_cv_header_magic_h" "$ac_includes_default"
if test "x$ac_cv_header_magic_h" = xyes; then :

Thanks,
../Randy 'often knows how to spell bitbake' MacLeod

Quoted 6 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
#3 lore raw
Quoted 59 lines · Randy MacLeod
Quoted 42 lines · Christopher Larson

On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    Without a packageconfig dependency for the file utility, there's
    a very rare compile faiure caused by a race where the magic.h
    header file is not found:

     ../../../git/lib/support/plausible.c:33:19: fatal error: magic.h:
    No such file or directory

    This file, plausible.c, is part of libsupport.a which is used by
    many binaries produced by the e2fsprogs package. plausible.c attempts
    to dynamically load libmagic.so if the e2fsprogs configure detects
    that magic was available. Adding the packageconfig will eliminate
    the build as well as the possible configure-time race condition.

    Signed-off-by: Randy MacLeod <[email protected]
    <mailto:[email protected]>>
    ---
     meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb> | 1 +
     1 file changed, 1 insertion(+)

    diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    index f4855bc..1707cb9 100644
    --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
    <http://e2fsprogs_1.43.bb>
    @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
    --sbindir=${base_sbindir} \
     EXTRA_OECONF_darwin = "--libdir=${base_libdir}
    --sbindir=${base_sbindir} --enable-bsd-shlibs"

     PACKAGECONFIG ??= ""
    +PACKAGECONFIG[file] = ',,file'
Quoted 5 lines

This isn’t going to be good enough. You aren’t explicitly enabling/disabling the option, so it’ll still detect based on what’s in the sysroot, so recipe build order will result in non-deterministic behavior.

Hi Christopher,

Thanks for the response but I don't understand. I'm probably wrong so please explain.
It seems that you're suggesting that I add:
--with[out]-magic to e2fsprogs configure, and while
I could do that, it does not seem to be needed.

Quoted 5 lines

Short response:

This change forces 'file' to be built before e2fsprogs if 'file' is present in the image or world build. Then e2fsprogs will detect magic.h,libmagic.so and the race is eliminated.

That’s only the case if ‘file’ is in PACKAGECONFIG, if not, it’ll still behave the way it did before, and change its deps based on build order. Our policy is to avoid floating deps period, regardless of PACKAGECONFIG. If a given packageconfig is not enabled, then explicitly disable the dependency, don’t detect and use it anyway.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#4 lore raw
Quoted 86 lines · Christopher Larson

On Sun, Sep 18, 2016 at 7:32 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    On 2016-09-17 01:09 AM, Christopher Larson wrote:


        On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod
        <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

            Without a packageconfig dependency for the file utility, there's
            a very rare compile faiure caused by a race where the magic.h
            header file is not found:

             ../../../git/lib/support/plausible.c:33:19: fatal error:
        magic.h:
            No such file or directory

            This file, plausible.c, is part of libsupport.a which is used by
            many binaries produced by the e2fsprogs package. plausible.c
        attempts
            to dynamically load libmagic.so if the e2fsprogs configure
        detects
            that magic was available. Adding the packageconfig will
        eliminate
            the build as well as the possible configure-time race condition.

            Signed-off-by: Randy MacLeod <[email protected]
        <mailto:[email protected]>
            <mailto:[email protected]
        <mailto:[email protected]>>>
            ---
             meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb> | 1 +
             1 file changed, 1 insertion(+)

            diff --git
        a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            index f4855bc..1707cb9 100644
            --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
            --sbindir=${base_sbindir} \
             EXTRA_OECONF_darwin = "--libdir=${base_libdir}
            --sbindir=${base_sbindir} --enable-bsd-shlibs"

             PACKAGECONFIG ??= ""
            +PACKAGECONFIG[file] = ',,file'


        This isn’t going to be good enough. You aren’t explicitly
        enabling/disabling the option, so it’ll still detect based on
        what’s in
        the sysroot, so recipe build order will result in non-deterministic
        behavior.


    Hi Christopher,

    Thanks for the response but I don't understand.
    I'm probably wrong so please explain.
    It seems that you're suggesting that I add:
     --with[out]-magic to e2fsprogs configure, and while
    I could do that, it does not seem to be needed.


    Short response:

      This change forces 'file' to be built before e2fsprogs if 'file'
      is present in the image or world build. Then e2fsprogs will
      detect magic.h,libmagic.so and  the race is eliminated.
Quoted 5 lines

That’s only the case if ‘file’ is in PACKAGECONFIG, if not, it’ll still behave the way it did before, and change its deps based on build order. Our policy is to avoid floating deps period, regardless of PACKAGECONFIG. If a given packageconfig is not enabled, then explicitly disable the dependency, don’t detect and use it anyway.

Ah right and now I see some uses where there would not be a package dependency required.

I'll likely send a v2 adding just:
PACKAGECONFIG ??= "file"
since 'fuse' is in the meta-filesystems layer but
I don't understand how the fuse dependency gets fixed since it's not changed in meta-oe/meta-filesystems AFAIKT. Should the fuse dependency be added as well so that builds that add the meta-filesystems layer don't have this potential race? I could do some testing to find out but it's late here. Robert likely knows all about this so I'm
CCing him since he also committed the fuse change.

It seems unlikely but we could have a pile of clean-up to do...

Thanks,
../Randy

Quoted 6 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

Signature · 2 lines
# Randy MacLeod. SMTS, Linux, Wind River
Direct: 613.963.1350 | 350 Terry Fox Drive, Suite 200, Ottawa, ON, Canada, K2K 2W5
#5 lore raw
Quoted 93 lines · Randy MacLeod
Quoted 86 lines · Christopher Larson

On Sun, Sep 18, 2016 at 7:32 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    On 2016-09-17 01:09 AM, Christopher Larson wrote:


        On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod
        <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

            Without a packageconfig dependency for the file utility, there's
            a very rare compile faiure caused by a race where the magic.h
            header file is not found:

             ../../../git/lib/support/plausible.c:33:19: fatal error:
        magic.h:
            No such file or directory

            This file, plausible.c, is part of libsupport.a which is used by
            many binaries produced by the e2fsprogs package. plausible.c
        attempts
            to dynamically load libmagic.so if the e2fsprogs configure
        detects
            that magic was available. Adding the packageconfig will
        eliminate
            the build as well as the possible configure-time race condition.

            Signed-off-by: Randy MacLeod <[email protected]
        <mailto:[email protected]>
            <mailto:[email protected]
        <mailto:[email protected]>>>
            ---
             meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb> | 1 +
             1 file changed, 1 insertion(+)

            diff --git
        a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            index f4855bc..1707cb9 100644
            --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
            --sbindir=${base_sbindir} \
             EXTRA_OECONF_darwin = "--libdir=${base_libdir}
            --sbindir=${base_sbindir} --enable-bsd-shlibs"

             PACKAGECONFIG ??= ""
            +PACKAGECONFIG[file] = ',,file'


        This isn’t going to be good enough. You aren’t explicitly
        enabling/disabling the option, so it’ll still detect based on
        what’s in
        the sysroot, so recipe build order will result in non-deterministic
        behavior.


    Hi Christopher,

    Thanks for the response but I don't understand.
    I'm probably wrong so please explain.
    It seems that you're suggesting that I add:
     --with[out]-magic to e2fsprogs configure, and while
    I could do that, it does not seem to be needed.


    Short response:

      This change forces 'file' to be built before e2fsprogs if 'file'
      is present in the image or world build. Then e2fsprogs will
      detect magic.h,libmagic.so and  the race is eliminated.
Quoted 5 lines

That’s only the case if ‘file’ is in PACKAGECONFIG, if not, it’ll still behave the way it did before, and change its deps based on build order. Our policy is to avoid floating deps period, regardless of PACKAGECONFIG. If a given packageconfig is not enabled, then explicitly disable the dependency, don’t detect and use it anyway.

Quoted 5 lines

Ah right and now I see some uses where there would not be a package dependency required.

I'll likely send a v2 adding just:
PACKAGECONFIG ??= "file"

I'm afraid that this can't fix the floating deps, if file is a must and can't be disabled, you can set:

DEPENDS += "file"

rather than use a PACKAGECONFIG.

Quoted 1 line

since 'fuse' is in the meta-filesystems layer but

For fuse:
PACKAGECONFIG ??= ""
PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'

It is disabled by default, but other layers use a e2fsprogs.bbappend or PACKAGECONFIG_pn-e2fsprogs = "fuse" in conf file to enable it.

Quoted 1 line

I don't understand how the fuse dependency gets fixed since

It is disabled by default (--disable-fuse2fs), this can fix the floating deps issue.

// Robert

Quoted 21 lines

it's not changed in meta-oe/meta-filesystems AFAIKT. Should the fuse dependency be added as well so that builds that add the meta-filesystems layer don't have this potential race? I could do some testing to find out but it's late here. Robert likely knows all about this so I'm
CCing him since he also committed the fuse change.

It seems unlikely but we could have a pile of clean-up to do...

Thanks,
../Randy

Quoted 6 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

#6 lore raw
Quoted 127 lines · Robert Yang
Quoted 98 lines · Randy MacLeod
Quoted 91 lines · Christopher Larson

On Sun, Sep 18, 2016 at 7:32 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    On 2016-09-17 01:09 AM, Christopher Larson wrote:


        On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod
        <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

            Without a packageconfig dependency for the file utility,

there's
a very rare compile faiure caused by a race where the magic.h header file is not found:

../../../git/lib/support/plausible.c:33:19: fatal error:
magic.h:
No such file or directory

This file, plausible.c, is part of libsupport.a which is used
by
many binaries produced by the e2fsprogs package. plausible.c
attempts
to dynamically load libmagic.so if the e2fsprogs configure
detects
that magic was available. Adding the packageconfig will
eliminate
the build as well as the possible configure-time race
condition.

            Signed-off-by: Randy MacLeod <[email protected]
        <mailto:[email protected]>
            <mailto:[email protected]
        <mailto:[email protected]>>>
            ---
             meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb> | 1 +
             1 file changed, 1 insertion(+)

            diff --git
        a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            index f4855bc..1707cb9 100644
            --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
            --sbindir=${base_sbindir} \
             EXTRA_OECONF_darwin = "--libdir=${base_libdir}
            --sbindir=${base_sbindir} --enable-bsd-shlibs"

             PACKAGECONFIG ??= ""
            +PACKAGECONFIG[file] = ',,file'


        This isn’t going to be good enough. You aren’t explicitly
        enabling/disabling the option, so it’ll still detect based on
        what’s in
        the sysroot, so recipe build order will result in

non-deterministic
behavior.

Hi Christopher,

Thanks for the response but I don't understand. I'm probably wrong so please explain.
It seems that you're suggesting that I add:
--with[out]-magic to e2fsprogs configure, and while
I could do that, it does not seem to be needed.

Short response:

This change forces 'file' to be built before e2fsprogs if 'file' is present in the image or world build. Then e2fsprogs will detect magic.h,libmagic.so and the race is eliminated.

Quoted 5 lines

That’s only the case if ‘file’ is in PACKAGECONFIG, if not, it’ll still behave the way it did before, and change its deps based on build order. Our policy is to avoid floating deps period, regardless of PACKAGECONFIG. If a given packageconfig is not enabled, then explicitly disable the dependency, don’t detect and use it anyway.

Quoted 7 lines

http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#checking-for-missing-build-time-dependencies

Ah right and now I see some uses where there would not be a package dependency required.

I'll likely send a v2 adding just:
PACKAGECONFIG ??= "file"

I'm afraid that this can't fix the floating deps, if file is a must and can't be disabled, you can set:

DEPENDS += "file"

rather than use a PACKAGECONFIG.

Quoted 1 line

since 'fuse' is in the meta-filesystems layer but

For fuse:
PACKAGECONFIG ??= ""
PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'

It is disabled by default, but other layers use a e2fsprogs.bbappend or PACKAGECONFIG_pn-e2fsprogs = "fuse" in conf file to enable it.

Quoted 7 lines
Quoted 1 line

I don't understand how the fuse dependency gets fixed since

It is disabled by default (--disable-fuse2fs), this can fix the floating deps issue.

// Robert

There is a relevant new section in the 2.2 reference manual by the way, that explains what floating dependencies are and why they are problematic:

http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#checking-for-missing-build-time-dependencies

Cheers,
Ulf

Quoted 28 lines
Quoted 8 lines

it's not changed in meta-oe/meta-filesystems AFAIKT. Should the fuse dependency be added as well so that builds that add the meta-filesystems layer don't have this potential race? I could do some testing to find out but it's late here. Robert likely knows all about this so I'm
CCing him since he also committed the fuse change.

Quoted 15 lines

It seems unlikely but we could have a pile of clean-up to do...

Thanks,
../Randy

Quoted 6 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#7 lore raw
Quoted 134 lines · Ulf Magnusson
Quoted 133 lines · Robert Yang
Quoted 98 lines · Randy MacLeod
Quoted 91 lines · Christopher Larson

On Sun, Sep 18, 2016 at 7:32 PM, Randy MacLeod <[email protected] <mailto:[email protected]>> wrote:

    On 2016-09-17 01:09 AM, Christopher Larson wrote:


        On Fri, Sep 16, 2016 at 6:37 PM, Randy MacLeod
        <[email protected]
        <mailto:[email protected]>
        <mailto:[email protected]
        <mailto:[email protected]>>> wrote:

            Without a packageconfig dependency for the file utility,

there's
a very rare compile faiure caused by a race where the magic.h header file is not found:

../../../git/lib/support/plausible.c:33:19: fatal error:
magic.h:
No such file or directory

This file, plausible.c, is part of libsupport.a which is used
by
many binaries produced by the e2fsprogs package. plausible.c
attempts
to dynamically load libmagic.so if the e2fsprogs configure
detects
that magic was available. Adding the packageconfig will
eliminate
the build as well as the possible configure-time race
condition.

            Signed-off-by: Randy MacLeod <[email protected]
        <mailto:[email protected]>
            <mailto:[email protected]
        <mailto:[email protected]>>>
            ---
             meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb> | 1 +
             1 file changed, 1 insertion(+)

            diff --git
        a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            index f4855bc..1707cb9 100644
            --- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            +++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.43.bb
        <http://e2fsprogs_1.43.bb>
            <http://e2fsprogs_1.43.bb>
            @@ -23,6 +23,7 @@ EXTRA_OECONF += "--libdir=${base_libdir}
            --sbindir=${base_sbindir} \
             EXTRA_OECONF_darwin = "--libdir=${base_libdir}
            --sbindir=${base_sbindir} --enable-bsd-shlibs"

             PACKAGECONFIG ??= ""
            +PACKAGECONFIG[file] = ',,file'


        This isn’t going to be good enough. You aren’t explicitly
        enabling/disabling the option, so it’ll still detect based on
        what’s in
        the sysroot, so recipe build order will result in

non-deterministic
behavior.

Hi Christopher,

Thanks for the response but I don't understand. I'm probably wrong so please explain.
It seems that you're suggesting that I add:
--with[out]-magic to e2fsprogs configure, and while
I could do that, it does not seem to be needed.

Short response:

This change forces 'file' to be built before e2fsprogs if 'file' is present in the image or world build. Then e2fsprogs will detect magic.h,libmagic.so and the race is eliminated.

Quoted 5 lines

That’s only the case if ‘file’ is in PACKAGECONFIG, if not, it’ll still behave the way it did before, and change its deps based on build order. Our policy is to avoid floating deps period, regardless of PACKAGECONFIG. If a given packageconfig is not enabled, then explicitly disable the dependency, don’t detect and use it anyway.

Quoted 7 lines

http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#checking-for-missing-build-time-dependencies

Ah right and now I see some uses where there would not be a package dependency required.

I'll likely send a v2 adding just:
PACKAGECONFIG ??= "file"

I'm afraid that this can't fix the floating deps, if file is a must and can't be disabled, you can set:

DEPENDS += "file"

rather than use a PACKAGECONFIG.

Quoted 1 line

since 'fuse' is in the meta-filesystems layer but

For fuse:
PACKAGECONFIG ??= ""
PACKAGECONFIG[fuse] = '--enable-fuse2fs,--disable-fuse2fs,fuse'

It is disabled by default, but other layers use a e2fsprogs.bbappend or PACKAGECONFIG_pn-e2fsprogs = "fuse" in conf file to enable it.

Quoted 1 line

I don't understand how the fuse dependency gets fixed since

It is disabled by default (--disable-fuse2fs), this can fix the floating deps issue.

Quoted 7 lines
Quoted 1 line

// Robert

There is a relevant new section in the 2.2 reference manual by the way, that explains what floating dependencies are and why they are problematic:

http://www.yoctoproject.org/docs/2.2/ref-manual/ref-manual.html#checking-for-missing-build-time-dependencies

Heh... just noticed that it had already been mentioned. It would be a good idea to also mention PACKAGECONFIG and the importance of explicitly disabling/enabling features that would otherwise be floating, to make things deterministic.

Cheers,
Ulf

Quoted 29 lines
Quoted 29 lines
Quoted 9 lines

it's not changed in meta-oe/meta-filesystems AFAIKT. Should the fuse dependency be added as well so that builds that add the meta-filesystems layer don't have this potential race? I could do some testing to find out but it's late here. Robert likely knows all about this so I'm
CCing him since he also committed the fuse change.

Quoted 15 lines

It seems unlikely but we could have a pile of clean-up to do...

Thanks,
../Randy

Quoted 6 lines

--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core