All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
@ 2022-01-20  7:27 Robert Yang
  2022-01-20  7:27 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Yang @ 2022-01-20  7:27 UTC (permalink / raw)
  To: bitbake-devel; +Cc: quaresma.jose

The following changes since commit 4f24d5daa63feba1849f9c6295597b97c3a42035:

  build-appliance-image: Update to master head revision (2022-01-19 23:04:08 +0000)

are available in the Git repository at:

  git://github.com/robertlinux/yocto rbt/network
  https://github.com/robertlinux/yocto/tree/rbt/network

Robert Yang (1):
  bitbake-worker: Check BB_TASK_NETWORK before disable network for task

 bitbake/bin/bitbake-worker | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.31.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
  2022-01-20  7:27 [PATCH 0/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task Robert Yang
@ 2022-01-20  7:27 ` Robert Yang
  2022-01-20 13:50   ` [bitbake-devel] " Peter Kjellerstedt
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Yang @ 2022-01-20  7:27 UTC (permalink / raw)
  To: bitbake-devel; +Cc: quaresma.jose

The NIS user can't work when task's network is disabled, so check
BB_TASK_NETWORK before disable it, the conf files can set BB_TASK_NETWORK.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 bitbake/bin/bitbake-worker | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index 3aaf3c2444b..3d7a781d35c 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder, workerdata, fn, task, taskname, taskha
 
                 bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
 
-                if not the_data.getVarFlag(taskname, 'network', False):
+                bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)
+                if not (bb_task_network or the_data.getVarFlag(taskname, 'network', False)):
                     logger.debug("Attempting to disable network")
                     bb.utils.disable_network(uid, gid)
 
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* RE: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
  2022-01-20  7:27 ` [PATCH 1/1] " Robert Yang
@ 2022-01-20 13:50   ` Peter Kjellerstedt
  2022-01-21  3:15     ` Robert Yang
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Kjellerstedt @ 2022-01-20 13:50 UTC (permalink / raw)
  To: Robert Yang, bitbake-devel; +Cc: quaresma.jose

> -----Original Message-----
> From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Robert Yang
> Sent: den 20 januari 2022 08:27
> To: bitbake-devel@lists.openembedded.org
> Cc: quaresma.jose@gmail.com
> Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
> 
> The NIS user can't work when task's network is disabled, so check
> BB_TASK_NETWORK before disable it, the conf files can set BB_TASK_NETWORK.
> 
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  bitbake/bin/bitbake-worker | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
> index 3aaf3c2444b..3d7a781d35c 100755
> --- a/bitbake/bin/bitbake-worker
> +++ b/bitbake/bin/bitbake-worker
> @@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder, workerdata,
> fn, task, taskname, taskha
> 
>                  bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
> 
> -                if not the_data.getVarFlag(taskname, 'network', False):
> +                bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)

Why use False to getVar() above?

> +                if not (bb_task_network or the_data.getVarFlag(taskname, 'network', False)):

I can't speak for others, but I find "not (foo or bar)" a lot harder to 
parse than "not foo and not bar".

>                      logger.debug("Attempting to disable network")
>                      bb.utils.disable_network(uid, gid)
> 
> --
> 2.31.1

//Peter



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
  2022-01-20 13:50   ` [bitbake-devel] " Peter Kjellerstedt
@ 2022-01-21  3:15     ` Robert Yang
  2022-01-21 15:36       ` Peter Kjellerstedt
  0 siblings, 1 reply; 5+ messages in thread
From: Robert Yang @ 2022-01-21  3:15 UTC (permalink / raw)
  To: Peter Kjellerstedt, bitbake-devel; +Cc: quaresma.jose

Hi Peter,

On 1/20/22 9:50 PM, Peter Kjellerstedt wrote:
>> -----Original Message-----
>> From: bitbake-devel@lists.openembedded.org <bitbake-devel@lists.openembedded.org> On Behalf Of Robert Yang
>> Sent: den 20 januari 2022 08:27
>> To: bitbake-devel@lists.openembedded.org
>> Cc: quaresma.jose@gmail.com
>> Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
>>
>> The NIS user can't work when task's network is disabled, so check
>> BB_TASK_NETWORK before disable it, the conf files can set BB_TASK_NETWORK.
>>
>> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
>> ---
>>   bitbake/bin/bitbake-worker | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
>> index 3aaf3c2444b..3d7a781d35c 100755
>> --- a/bitbake/bin/bitbake-worker
>> +++ b/bitbake/bin/bitbake-worker
>> @@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder, workerdata,
>> fn, task, taskname, taskha
>>
>>                   bb.utils.set_process_name("%s:%s" % (the_data.getVar("PN"), taskname.replace("do_", "")))
>>
>> -                if not the_data.getVarFlag(taskname, 'network', False):
>> +                bb_task_network = bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)
> 
> Why use False to getVar() above?

The False is for bb.utils.to_boolean(), not getVar(), the getVar has only one 
argument:

the_data.getVar('BB_TASK_NETWORK')

> 
>> +                if not (bb_task_network or the_data.getVarFlag(taskname, 'network', False)):
> 
> I can't speak for others, but I find "not (foo or bar)" a lot harder to
> parse than "not foo and not bar".

Technically, the "not (foo or bar)" is slightly faster than "not foo and not
bar" since the latter one requires more logical evaluates.

// Robert

> 
>>                       logger.debug("Attempting to disable network")
>>                       bb.utils.disable_network(uid, gid)
>>
>> --
>> 2.31.1
> 
> //Peter
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task
  2022-01-21  3:15     ` Robert Yang
@ 2022-01-21 15:36       ` Peter Kjellerstedt
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Kjellerstedt @ 2022-01-21 15:36 UTC (permalink / raw)
  To: Robert Yang, bitbake-devel; +Cc: quaresma.jose

> -----Original Message-----
> From: Robert Yang <liezhi.yang@windriver.com>
> Sent: den 21 januari 2022 04:15
> To: Peter Kjellerstedt <peter.kjellerstedt@axis.com>; bitbake-
> devel@lists.openembedded.org
> Cc: quaresma.jose@gmail.com
> Subject: Re: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check
> BB_TASK_NETWORK before disable network for task
> 
> Hi Peter,
> 
> On 1/20/22 9:50 PM, Peter Kjellerstedt wrote:
> >> -----Original Message-----
> >> From: bitbake-devel@lists.openembedded.org <bitbake-
> devel@lists.openembedded.org> On Behalf Of Robert Yang
> >> Sent: den 20 januari 2022 08:27
> >> To: bitbake-devel@lists.openembedded.org
> >> Cc: quaresma.jose@gmail.com
> >> Subject: [bitbake-devel] [PATCH 1/1] bitbake-worker: Check
> BB_TASK_NETWORK before disable network for task
> >>
> >> The NIS user can't work when task's network is disabled, so check
> >> BB_TASK_NETWORK before disable it, the conf files can set
> BB_TASK_NETWORK.
> >>
> >> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> >> ---
> >>   bitbake/bin/bitbake-worker | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
> >> index 3aaf3c2444b..3d7a781d35c 100755
> >> --- a/bitbake/bin/bitbake-worker
> >> +++ b/bitbake/bin/bitbake-worker
> >> @@ -261,7 +261,8 @@ def fork_off_task(cfg, data, databuilder,
> workerdata,
> >> fn, task, taskname, taskha
> >>
> >>                   bb.utils.set_process_name("%s:%s" %
> (the_data.getVar("PN"), taskname.replace("do_", "")))
> >>
> >> -                if not the_data.getVarFlag(taskname, 'network',
> False):
> >> +                bb_task_network =
> bb.utils.to_boolean(the_data.getVar('BB_TASK_NETWORK'), False)
> >
> > Why use False to getVar() above?
> 
> The False is for bb.utils.to_boolean(), not getVar(), the getVar has only
> one argument:
> 
> the_data.getVar('BB_TASK_NETWORK')

Duh, of course. I guess I need new glasses...

> >
> >> +                if not (bb_task_network or
> the_data.getVarFlag(taskname, 'network', False)):
> >
> > I can't speak for others, but I find "not (foo or bar)" a lot harder to
> > parse than "not foo and not bar".
> 
> Technically, the "not (foo or bar)" is slightly faster than "not foo and
> not bar" since the latter one requires more logical evaluates.

Somehow, I think you will find it hard to actually measure that time 
difference... ;) I tried, and in my testing the time to execute either 
statement was 0.07-0.12 μs, i.e., it was impossible to declare either 
as faster than the other.

> // Robert
> 
> >
> >>                       logger.debug("Attempting to disable network")
> >>                       bb.utils.disable_network(uid, gid)
> >>
> >> --
> >> 2.31.1
> >
> > //Peter

//Peter



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-21 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-20  7:27 [PATCH 0/1] bitbake-worker: Check BB_TASK_NETWORK before disable network for task Robert Yang
2022-01-20  7:27 ` [PATCH 1/1] " Robert Yang
2022-01-20 13:50   ` [bitbake-devel] " Peter Kjellerstedt
2022-01-21  3:15     ` Robert Yang
2022-01-21 15:36       ` Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.