Bug 1043231

Summary: yum does not succeed in marking package groups installed with an environment group
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: yumAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: admiller, bclary, collura, ffesti, firas.alkafri, jawr, kparal, michael.ddek, packaging-team-maint, theo148, tristan, zpavlas
Target Milestone: ---Keywords: CommonBugs
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: https://fedoraproject.org/wiki/Common_F20_bugs#yum-group-errors
Fixed In Version: yum-3.4.3-128.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-12-25 02:37:56 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Adam Williamson 2013-12-15 08:18:37 UTC
This bug is to split out the issue I've been tracing down in https://bugzilla.redhat.com/show_bug.cgi?id=1014202 comments #21 and onwards.

The clean example of the problem that I'm using is this:

1. Do a clean minimal install of Fedora 19 or 20
2. Verify that there are no files in /var/lib/yum/groups , and 'yum group list hidden' does not list any package or environment groups as being installed
3. Run 'yum group install web-server-environment'
4. Inspect /var/lib/yum/groups/environment . Note that all the package groups in the 'web-server-environment' environment group have 'false' after them.
5. If you like, run 'yum group install web-server-environment' again, and note that it claims the group does not exist: this is #1014202 .
6. Try 'yum remove web-server-environment': it returns 'No group named web-server-environment exists', then 'No packages to remove from groups'

We hit #1014202 here because of the chain explained in https://bugzilla.redhat.com/show_bug.cgi?id=1014202#c22 . _groupInstalledEnvData considers all the package groups associated with the environment group to be "blacklisted-installed", and that eventually winds up causing the inaccurate warning.

This underlying problem seems like the most serious one, though. That bug is just an inaccurate message; the underlying bug is a practical one, because I think yum just never actually manages to track that any package group is installed due to any environment group.

I believe /var/lib/yum/groups/environment is meant to list all environment groups, and under each environment group, list the package groups inside it, and if that package group was installed as a part of the environment group, the word "true"; if it wasn't, the word "false". But the test above indicates pretty clearly that this isn't happening.

The actual code here, which I've been staring at for the last four hours, is the function _write_grp_grps(self) in igroups.py:

-----------------

    def _write_grp_grps(self):
        fo = _open_no_umask(self.grp_filename + '.tmp', 'w')

        fo.write("1\n") # version
        fo.write("%u\n" % len(self.environments))
        for evgrp in sorted(self.environments.values()):
            fo.write("%s\n" % evgrp.evgid)
            fo.write("%u\n" % len(evgrp.grp_names))
            for grpname in sorted(evgrp.grp_names):
                fo.write("%s\n" % grpname)
                if (grpname in self.groups and
                    self.groups[grpname].environment == evgrp.evgid):
                    fo.write("%s\n" % "true")
                else:
                    fo.write("%s\n" % "false")

        fo.close()
        os.rename(self.grp_filename + '.tmp', self.grp_filename)

----------------

I think I know what's wrong in this. I hacked some incredibly ugly QA-monkey debug output into it:

----------------

                if grpname in self.groups:
                    fo.write("# group in self.groups\n")
                    fo.write("# sgge: %s\n" % self.groups[grpname].environment)
                    fo.write("# ee: %s\n" % evgrp.egid)
                    if self.groups[grpname].environment == evgrp.evgid:
                        fo.write("%s\n" % "true")
                    else:
                        fo.write("%s\n" % "false")
                else:
                    fo.write("%s\n" % "false")

------------------

yeah, okay, I don't know a way to write the debug output anywhere else except into the file. Please don't laugh at me.

When I do this, then do 'yum remove httpd', 'rm -f /var/lib/yum/groups/*', 'yum group install web-server-environment' (a little hack I figured out to avoid having to blow the machine away and start over every time), here's the file that gets written:

--------------------

1
1
web-server-environment
15
core
# group in self.groups
# sgge: None
# ee: web-server-environment
false
guest-agents
false
haproxy
false
hardware-support
# group in self.groups
# sgge: None
# ee: web-server-environment
false
jbossas
false
mongodb
false
mysql
false
perl-web
false
php
false
python-web
false
rubyonrails
false
sql-server
false
standard
# group in self.groups
# sgge: None
# ee: web-server-environment
false
tomcat
false
web-server
# group in self.groups
# sgge: None
# ee: web-server-environment
false

------------------------

If you follow what I was doing, it's showing that every time that check is run, self.groups[grpname].environment evaluates to None. So the comparison always fails, and it never writes "true".

If I didn't balls up anywhere, it means that somehow, "self.groups[grpname].environment" is not actually giving us the environment group associated with the package group "grpname" (which I think is what it's trying to do). I don't know why not.

Comment 1 Fedora Update System 2013-12-19 05:21:49 UTC
yum-3.4.3-127.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/yum-3.4.3-127.fc20

Comment 2 Fedora Update System 2013-12-19 18:41:54 UTC
yum-3.4.3-127.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/yum-3.4.3-127.fc19

Comment 3 Fedora Update System 2013-12-20 01:50:44 UTC
Package yum-3.4.3-127.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing yum-3.4.3-127.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-23627/yum-3.4.3-127.fc20
then log in and leave karma (feedback).

Comment 4 Fedora Update System 2013-12-25 02:37:56 UTC
yum-3.4.3-128.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 Fedora Update System 2014-01-01 03:31:51 UTC
yum-3.4.3-128.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.