From: Zac Medico Date: Thu, 24 Sep 2009 22:15:48 +0000 (-0000) Subject: Fix regression in _getitem() from r14398, since myf.read().split("\n") X-Git-Tag: v2.2_rc42~17 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=3df9061abdeba371dabcab9754be90866ff1d0ad;p=portage.git Fix regression in _getitem() from r14398, since myf.read().split("\n") yields an empty string at the end which is causes _parse_data() to catch a ValueError and raise CacheCorruption. svn path=/main/trunk/; revision=14416 --- diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py index 983055a4b..49d7ce6a0 100644 --- a/pym/portage/cache/flat_hash.py +++ b/pym/portage/cache/flat_hash.py @@ -41,7 +41,10 @@ class database(fs_template.FsBased): mode='r', encoding=_encodings['repo.content'], errors='replace') try: - d = self._parse_data(myf.read().split("\n"), cpv) + lines = myf.read().split("\n") + if not lines[-1]: + lines.pop() + d = self._parse_data(lines, cpv) if '_mtime_' not in d: # Backward compatibility with old cache # that uses mtime mangling.