Re: [gentoo-portage-dev] [PATCH] emerge: fix error handling for clean_logs

2017-01-25 Thread Mike Gilbert
On Wed, Jan 25, 2017 at 10:42 PM, Zac Medico  wrote:
> On 01/25/2017 07:16 PM, Mike Gilbert wrote:
>> Commit f143e58dd changed the return value of CleanLogs.clean() to a
>> tuple (returncode, messages).
>>
>> X-Gentoo-Bug: 607236
>> X-Gentoo-Bug-URL: https://bugs.gentoo.org/607236
>> ---
>>  pym/_emerge/post_emerge.py | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py
>> index 0cb533cf8..7e6063c52 100644
>> --- a/pym/_emerge/post_emerge.py
>> +++ b/pym/_emerge/post_emerge.py
>> @@ -29,10 +29,10 @@ def clean_logs(settings):
>>   return
>>
>>   cleanlogs = CleanLogs()
>> - errors = cleanlogs.clean(settings=settings)
>> - if errors:
>> + returncode, msgs = cleanlogs.clean(settings=settings)
>> + if not returncode:
>>   out = portage.output.EOutput()
>> - for msg in errors:
>> + for msg in msgs:
>>   out.eerror(msg)
>>
>>  def display_news_notification(root_config, myopts):
>>
>
> I like Fixes: tags [1]. Otherwise, looks good.

Thanks. I adjusted the commit message and pushed this.



Re: [gentoo-portage-dev] [PATCH] emerge: fix error handling for clean_logs

2017-01-25 Thread Zac Medico
On 01/25/2017 07:16 PM, Mike Gilbert wrote:
> Commit f143e58dd changed the return value of CleanLogs.clean() to a
> tuple (returncode, messages).
> 
> X-Gentoo-Bug: 607236
> X-Gentoo-Bug-URL: https://bugs.gentoo.org/607236
> ---
>  pym/_emerge/post_emerge.py | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py
> index 0cb533cf8..7e6063c52 100644
> --- a/pym/_emerge/post_emerge.py
> +++ b/pym/_emerge/post_emerge.py
> @@ -29,10 +29,10 @@ def clean_logs(settings):
>   return
>  
>   cleanlogs = CleanLogs()
> - errors = cleanlogs.clean(settings=settings)
> - if errors:
> + returncode, msgs = cleanlogs.clean(settings=settings)
> + if not returncode:
>   out = portage.output.EOutput()
> - for msg in errors:
> + for msg in msgs:
>   out.eerror(msg)
>  
>  def display_news_notification(root_config, myopts):
> 

I like Fixes: tags [1]. Otherwise, looks good.

[1]
https://kernel.org/doc/html/latest/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes
-- 
Thanks,
Zac



[gentoo-portage-dev] [PATCH] emerge: fix error handling for clean_logs

2017-01-25 Thread Mike Gilbert
Commit f143e58dd changed the return value of CleanLogs.clean() to a
tuple (returncode, messages).

X-Gentoo-Bug: 607236
X-Gentoo-Bug-URL: https://bugs.gentoo.org/607236
---
 pym/_emerge/post_emerge.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pym/_emerge/post_emerge.py b/pym/_emerge/post_emerge.py
index 0cb533cf8..7e6063c52 100644
--- a/pym/_emerge/post_emerge.py
+++ b/pym/_emerge/post_emerge.py
@@ -29,10 +29,10 @@ def clean_logs(settings):
return
 
cleanlogs = CleanLogs()
-   errors = cleanlogs.clean(settings=settings)
-   if errors:
+   returncode, msgs = cleanlogs.clean(settings=settings)
+   if not returncode:
out = portage.output.EOutput()
-   for msg in errors:
+   for msg in msgs:
out.eerror(msg)
 
 def display_news_notification(root_config, myopts):
-- 
2.11.0




[gentoo-portage-dev] [PATCH] spawn: instantiate userpriv_groups before fork (bug 582098)

2017-01-25 Thread Zac Medico
Make spawn force instantiation of portage.data.userpriv_groups in the
main process, in order to avoid redundant instantiation in child
processes. This mitigates the impact of "Bad file descriptor" errors
reported in bug 582098, by avoiding redundant instantiation of
userpriv_groups in child processes. It may even solve the problem
completely, if the "Bad file descriptor" errors are triggered by
interactions between garbage collection and the file descriptor
operations performed in the _exec function by the _setup_pipes call.

X-Gentoo-Bug: 582098
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=582098
---
 pym/portage/process.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/pym/portage/process.py b/pym/portage/process.py
index ba41ea8..bc4efb5 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -305,6 +305,10 @@ def spawn(mycommand, env={}, opt_name=None, fd_pipes=None, 
returnpid=False,
if unshare_net or unshare_ipc:
find_library("c")
 
+   # Force instantiation of portage.data.userpriv_groups before the
+   # fork, so that the result is cached in the main process.
+   bool(groups)
+
parent_pid = os.getpid()
pid = None
try:
-- 
2.10.2