Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 763342

Summary: sys-apps/portage: emerge exit code is 0 on @world update with masked packages in world file
Product: Portage Development Reporter: Ogelpre <gentoo.org>
Component: CoreAssignee: Portage team <dev-portage>
Status: RESOLVED INVALID    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Ogelpre 2021-01-03 23:10:36 UTC
If emerge fails because a not yet merged package in world file is masked, the exit code is zero but should be none zero.

Reproducible: Always

Steps to Reproduce:
Write a masked package to /var/lib/portage. For example net-nds/shelldap.
Try to update world.

binhost ~ # emerge -1uND @world

These are the packages that would be merged, in reverse order:

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 KiB

!!! Problems have been detected with your world file
!!! Please run emaint --check world


!!! Ebuilds for the following packages are either all
!!! masked or don't exist:
net-nds/shelldap

Nothing to merge; quitting.
Actual Results:  
Actual results:

binhost ~ # echo $?
0

Expected Results:  
Expected Results:

binhost ~ # echo $?
1
Comment 1 Mike Gilbert gentoo-dev 2021-01-03 23:19:18 UTC
I don't think writing things in /var/lib/portage/world directly is "supported".

Having a masked package installed isn't really an error either.
Comment 2 Ogelpre 2021-01-03 23:44:12 UTC
(In reply to Mike Gilbert from comment #1)
> I don't think writing things in /var/lib/portage/world directly is
> "supported".
> 
> Having a masked package installed isn't really an error either.

That's not the point. I just used this as small example to trigger the behaviour.

I am running emerge from ansible and ansible didn't fail because the return code was 0.

Emerge complains about a problem with world file. The Messages starting with "!!!" are printed to stderr.

So the main question is if this is an expected behaviour and the output to stderr is just for diagnostic purpose or if it is a serious error and portage should exit with an none zero exit code.
Comment 3 Zac Medico gentoo-dev 2021-01-04 00:20:51 UTC
The "Problems have been detected with your world file" thing is intended to be a non-fatal warning message. We could change it to an ewarn style message.
Comment 4 Ogelpre 2021-01-04 00:28:02 UTC
(In reply to Zac Medico from comment #3)
> The "Problems have been detected with your world file" thing is intended to
> be a non-fatal warning message. We could change it to an ewarn style message.

When the behaviour is expected it is ok for me. A workaround for my scripting issue is an additional check if stderr is not empty.