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

Bug 689308

Summary: acct-user.eclass: do not die during unmerge if the user does not exist
Product: Gentoo Linux Reporter: Eray Aslan <eras>
Component: EclassesAssignee: Michał Górny <mgorny>
Status: RESOLVED FIXED    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: acct-user.patch

Description Eray Aslan gentoo-dev 2019-07-05 08:12:40 UTC
Created attachment 581942 [details, diff]
acct-user.patch

manually deleting $user and then unmerging acct-user/$user results in:

>>> Unmerging (1 of 1) acct-user/postfix-0...
 * User does not exist, cannot set shell -- skipping.
 * User does not exist, cannot set comment -- skipping.
usermod: user 'postfix' does not exist
 * ERROR: acct-user/postfix-0::gentoo failed (prerm phase):
 *   Locking account postfix failed
[...]

I think the following behaviour is a better user experience:

>>> Unmerging (1 of 1) acct-user/postfix-0...
 * User does not exist, cannot set shell -- skipping.
 * User does not exist, cannot set comment -- skipping.
 * User does not exist, cannot lock user -- skipping.

see attached for a possible patch.
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2019-07-05 09:14:14 UTC
Yes, that makes sense.  I suppose we can't have a cleaner implementation than that.  I'll verify it in a few minutes, and send to ml for feedback.
Comment 2 Larry the Git Cow gentoo-dev 2019-07-05 15:44:33 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d61d24f4818eef45f8e7ba2e4a7c508ad5bdfb43

commit d61d24f4818eef45f8e7ba2e4a7c508ad5bdfb43
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2019-07-05 10:01:39 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2019-07-05 15:44:19 +0000

    acct-user.eclass: Skip locking if account does not exist
    
    Closes: https://bugs.gentoo.org/689308
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 eclass/acct-user.eclass | 6 ++++++
 1 file changed, 6 insertions(+)