Re: [OE-core] [PATCH v5 01/22] gstreamer1.0: Fix reproducibility issue around libcap

Richard Purdie
2020-10-29T22:42:45Z

On Thu, 2020-10-29 at 22:10 +0000, Jose Quaresma wrote:
> Jose Quaresma via lists.openembedded.org
> <quaresma.jose=gmail.com@lists.openembedded.org> escreveu no dia
> quinta, 29/10/2020 à(s) 16:58:
> > I will need to rebuild and check if when setcap is enabled it will
> > pick setcap from host on from libcap-
> > native.
> >
> > Richard Purdie <richard.purdie@linuxfoundation.org> escreveu no dia
> > quinta, 29/10/2020 à(s) 16:43:
> > > On Thu, 2020-10-29 at 16:13 +0000, Jose Quaresma wrote:
> > > > It looks for setcap in /usr/sbin and /sbin but needs libcap as
> > > > wheel.
> > > > when we have libcaps on DEPENDS as with version 1.16 and the
> > > > host
> > > > system has setcap binary, it introduces a dependency on the
> > > > host
> > > > system.
> > > > The patch fixes this situation.
> > > >
> > > > But libcap is only needed if we need to use the setcap
> > > > So remove libcap from DEPENDS will fail to use
> > > > 'ptp-helper-permissions=capabilities' even if setcap is found
> > > > on the
> > > > host.
> > > >
> > > > In my opinion this a better description can be used in this
> > > > PACKAGECONFIG, something like this:
> > > >
> > > > -PACKAGECONFIG[setcap] = ",,libcap libcap-native"
> > > > +PACKAGECONFIG[capabilities] =
> > > > "-Dptp-helper-permissions=capabilities,,libcap libcap-native"
> > >
> > > So you're saying that as long as setcap isn't in DEPENDS, we're
> > > ok?
>
> Yes it's correct.
>
> > > That means your patchset as it stands should be ok?
>
> Yes it's correct.
>
> > > If the user enables capabilities, it won't find setcap from
> > > libcap-
> > > native though will it? That is a potential problem even if its
> > > not the
> > > default?
>
> Yes it find the setcap on recipe-sysroot-native
>
> The help of messon find_program said that it will find the program in
> the first arg
> and fallback to the other if the last one fails. In this case it
> first
> find setcap on the PATH
> setcap = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap',
> required : false)
> https://mesonbuild.com/Reference-manual.html#find_program
>
> I made a little change on the souce to check this:
>
> +++ b/libs/gst/helpers/meson.build
> @@ -67,6 +67,7 @@ if have_ptp
> endif
>
> setcap_prog = find_program('setcap', '/usr/sbin/setcap',
> '/sbin/setcap', required : false)
> + message('setcap_prog: ' + setcap_prog.full_path())
> cap_dep = dependency('libcap', required: false)
>
> # user/group to change to in gst-ptp-helper
>
> This give me:
>
> # with PACKAGECONFIG_append = "setcap"
> bitbake gstreamer1.0 -c configure -v -f | grep setcap_prog
> Message: setcap_prog:
> /work/build/tmp/work/armv7vet2hf-neon-poky-linux-
> gnueabi/gstreamer1.0/1.18.0-r0/recipe-sysroot-native/usr/sbin/setcap
>
> # with PACKAGECONFIG_remove = "setcap"
> bitbake gstreamer1.0 -c configure -v -f | grep setcap_prog
> Message: setcap_prog: /sbin/setcap

Thanks for confirming that, sounds like the patch is indeed no longer
needed. I was worried it wouldn't behave like that.

Cheers,

Richard