Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 69388 - lost environment variable in portage.py:config.reset
Summary: lost environment variable in portage.py:config.reset
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Configuration (show other bugs)
Hardware: All All
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2004-10-29 02:27 UTC by Ludovic Aubry
Modified: 2005-07-14 06:58 UTC (History)
0 users

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 Ludovic Aubry 2004-10-29 02:27:27 UTC
in portage.py : class config, method reset the following loop deletes a random environment variable:
		for x in self.backupenv.keys():
			self.configdict["env"][x] = self.backupenv[x]
		else:
			del self.configdict["env"][x]
the for loop terminates with x being the last key of self.backupenv.keys()
since no break occured inside the loop the else clause is executed deleting the key from configdict["env"]. key orders in a dict is dependent on the hashing algorithm so the same arbitrary key is deleted each time.



Reproducible: Always
Steps to Reproduce:
This is from a stage 1 install, just sync no bootstrap yet
1. cd /usr/lib/portage/pym
2. python
3.
>>> from portage import settings
>>> print len(settings.configdict["env"])
49
>>> settings.reset()
>>> print len(settings.configdict["env"])
48





solution: replace this loop by:
self.configdict["env"].update(self.backupenv)

BTW, the second loop that clears configdict["pkg"] can be done by:
self.configdict["pkg"].clear()
Comment 1 Jason Stubbs (RETIRED) gentoo-dev 2005-07-14 05:48:15 UTC
Fixed on or before 2.0.51.22-r1 
Comment 2 Jason Stubbs (RETIRED) gentoo-dev 2005-07-14 06:58:53 UTC
Looking through the batch of bugs, I'm not sure that some of these are 
actually fixed in stable. Others, the requirements have possibly changed after 
the initial fix was committed. 
 
If you think this bug has been closed incorrectly, please reopen or ask that 
it be reopened.