From ac3bbd986755acb020f71c1a204ebe87f219200c Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Sat, 10 Dec 2011 13:54:51 +0100 Subject: [PATCH] config: remove destructive user/grpname guessing --- pym/portage/package/ebuild/config.py | 62 +++++++++++++++------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 89a2eb188..fb2167c62 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -732,34 +732,40 @@ class config(object): "PORTAGE_INST_UID": "0", } - if eprefix: - # For prefix environments, default to the UID and GID of - # the top-level EROOT directory. - try: - eroot_st = os.stat(eroot) - except OSError: - pass - else: - default_inst_ids["PORTAGE_INST_GID"] = str(eroot_st.st_gid) - default_inst_ids["PORTAGE_INST_UID"] = str(eroot_st.st_uid) - - if "PORTAGE_USERNAME" not in self: - try: - pwd_struct = pwd.getpwuid(eroot_st.st_uid) - except KeyError: - pass - else: - self["PORTAGE_USERNAME"] = pwd_struct.pw_name - self.backup_changes("PORTAGE_USERNAME") - - if "PORTAGE_GRPNAME" not in self: - try: - grp_struct = grp.getgrgid(eroot_st.st_gid) - except KeyError: - pass - else: - self["PORTAGE_GRPNAME"] = grp_struct.gr_name - self.backup_changes("PORTAGE_GRPNAME") + # PREFIX LOCAL: inventing UID/GID based on a path is a very + # bad idea, it breaks almost everything since group ids + # don't have to match, when a user has many + # This in particularly breaks the configure-set portage + # group and user (in portage/data.py) + #if eprefix: + # # For prefix environments, default to the UID and GID of + # # the top-level EROOT directory. + # try: + # eroot_st = os.stat(eroot) + # except OSError: + # pass + # else: + # default_inst_ids["PORTAGE_INST_GID"] = str(eroot_st.st_gid) + # default_inst_ids["PORTAGE_INST_UID"] = str(eroot_st.st_uid) + + # if "PORTAGE_USERNAME" not in self: + # try: + # pwd_struct = pwd.getpwuid(eroot_st.st_uid) + # except KeyError: + # pass + # else: + # self["PORTAGE_USERNAME"] = pwd_struct.pw_name + # self.backup_changes("PORTAGE_USERNAME") + + # if "PORTAGE_GRPNAME" not in self: + # try: + # grp_struct = grp.getgrgid(eroot_st.st_gid) + # except KeyError: + # pass + # else: + # self["PORTAGE_GRPNAME"] = grp_struct.gr_name + # self.backup_changes("PORTAGE_GRPNAME") + # END PREFIX LOCAL for var, default_val in default_inst_ids.items(): try: -- 2.26.2