Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 702656 - acct-user/mythtv should respect existing user configuration
Summary: acct-user/mythtv should respect existing user configuration
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Wilson M. Michaels
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-13 09:38 UTC by thomas
Modified: 2019-12-17 17:26 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description thomas 2019-12-13 09:38:54 UTC
When installing acct-user/mythtv, it changed the home directory of an existing user mythtv on one of my machines. This was not good.

On all machines, it removed existing group memberships, also not good. I had to re-add it manually afterwards.

Since 10 years, user mythtv is the main normal user on one of my machines (dedicated mythtv machine). After installation of acct-user/mythtv, it was removed from group wheel and so I could not su anymore.


Reproducible: Always

Steps to Reproduce:
1. Manually create user mythtv with group memberships
2. Install acct-user/mythtv
3.
Actual Results:  
Home directory changed. Group memberships removed.

Expected Results:  
Leave home directory and existing group memberships alone, if the user already exists.
Comment 1 Wilson M. Michaels 2019-12-13 18:51:24 UTC
Did you uninstall package acct-user/mythtv at any time?

Emerge acct-user/mythtv does not alter the home directory of an existing mythtv user. Manually uninstalling acct-user removes the mythtv user. The old home directory is not deleted, but its association with mythtv user is removed. Emerge --depclean uninstalls acct-user when no installed packages depend on it. 

Reinstalling/upgrading >=mythtv-30.0 does not uninstall acct-user/mythtv.
Comment 2 thomas 2019-12-13 20:39:19 UTC
I updated the system, including mythtv (was 29.0 before). This was the first time, acct-user/mythtv was installed.
And it did change the home directory of the existing user. And it deleted group memberships.
Comment 3 thomas 2019-12-14 06:35:06 UTC
BTW, it changed the home directory of the existing user on 2 out of 3 systems. On the 3rd one it printed something about "cannot change because in use". Maybe because I was logged in as user mythtv on the 3rd system.
Comment 4 Wilson M. Michaels 2019-12-14 16:08:49 UTC
Thank you for the observation. All my testing was done with a mythtv user logged in. 

I will change the ebuild to check for a user named mythtv logged in or not. If found do not depend on acct-user/mythtv to insure legacy systems are not corrupted.
Comment 5 thomas 2019-12-14 16:38:11 UTC
Cool, thanks.
It did however also remove group memberships on the machine where I was logged in.
Comment 6 Wilson M. Michaels 2019-12-14 21:40:51 UTC
I had no luck fixing the ebuild so I asked for help:

On Sat, 2019-12-14 at 14:47 -0600, The Bit Pit wrote:
> acct-user/mythtv modifies the existing user if that user is not logged 
> in. Mythtv has been around for years and users have created specialized 
> configurations for the mythtv user. They do not like changes to the 
> mythtv user when upgrading.
>
> A couple of solutions:
>
> 1)
> the ebuild does not depend on acct-user/mythtv when the user already 
> exists. This prevents both the changing and deletion of the existing user.
>
> What is the gentoo way to discover a preexisting user? Repoman does not 
> like anything I tried using egetent passwd mythtv
>
> 2)  Add something to the acct-user/mythtv to (conditionally) prevent any 
> change if there is a preexisting user on the system. The acct-user 
> unmerge would also check that the user was not modified since it was 
> created by acct-user. This seems like a lot of work.
>

Users are supposed to create a local acct-user/mythtv override if they
want to use a custom setup.

-- 
Best regards,
Michał Górny

I take this to mean that you create your own custom ebuild at /usr/local/portage/acct-user/mythtv/mythtv-0.ebuild and run "repoman manifest" get it to emerge. Another was is to use a bigger hammer and mask the package acct-user/mythtv in package.mask.
Comment 7 thomas 2019-12-15 09:15:20 UTC
Creating a custom acct-user/mythtv ebuild means knowing in advance that the standard ebuild will destroy your existing user.

Wouldn't it be easier to modify the acct-user/mythtv ebuild (instead of mythtv itself), so that it isntalls but does NOTHING if the user mythtv already exists?
Comment 8 Wilson M. Michaels 2019-12-16 19:29:12 UTC
I have not figured out how to test for the existence of a preexisting user in the mythtv ebuild anymore because that functionality is deprecated.

I am a new proxy-maintainer (4 months) and can not commit any changes to the gentoo tree. One or more gentoo developers must review my pull request. They are strict and do not allow use of deprecated functionality. The deprecated code is still in portage to allow existing ebuilds to work, all new commits must use current portage constructs.

I created a bug that acct-user.eclass violated CONFIG_PROTECT, but that was shot down.

About a year ago acct-user and acct-group eclasses were added to portage. The functions to manipulate a user or group were moved to the new acct-user and acct-group eclasses. acct-user.eclass defines how a user must be configured. By default acct-user/mythtv ebuild changes an existing user to be exactly as specified. There is an option to force failure when as existing user is different. This will likely result in a different bug I can't fix. (It will however protect an existing user that has been modified)

Solution:
Force the acct-user/mythtv to fail when an existing mythtv user does not match the one in gentoo (or a custom overlay). There are at least two ways to continue an emerge:
--keep-going
--skip-first --resume (If you didn't use first option and it failed)

Skipping the emerge is OK if you don't want to change the existing user anyway.
If you want the default, delete the user and try again. ( --resume )

A proper fix is to create a custom overlay for acct-user/mythtv for your system to prevent failing of emerge acct-user/mythtv. For new installations acct-user/mythtv will create a default and subsequent changes to mythtv user will not cause problems since acct-user/mythtv is not emerged again (unless removed/forced).
Comment 9 Wilson M. Michaels 2019-12-16 19:54:46 UTC
Actually the only thing I can add to cause emerge to fail is when the mythtv user does not have the default UID. 

That will help, but I really can't fix this bug.
Comment 10 thomas 2019-12-17 17:26:21 UTC
Thanks a lot for trying and the effort.