diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-01-16 04:32:23 -0800 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-01-16 04:32:23 -0800 |
commit | f7d169d516a2fbaf457057cb5e17a84f9ad13d04 (patch) | |
tree | 399464524ee80e814e62a05903566cdab71533db | |
parent | f707221b69ed913b7a1cb66c7ab45be2d1586f7c (diff) | |
download | portage-f7d169d516a2fbaf457057cb5e17a84f9ad13d04.tar.gz portage-f7d169d516a2fbaf457057cb5e17a84f9ad13d04.tar.bz2 portage-f7d169d516a2fbaf457057cb5e17a84f9ad13d04.zip |
CONTENTS: handle malformed sym entries
This will fix bug #351814.
-rw-r--r-- | pym/portage/dbapi/vartree.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 9f75da21b..7a1ef5929 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1196,7 +1196,8 @@ class dblink(object): _contents_re = re.compile(r'^(' + \ r'(?P<dir>(dev|dir|fif) (.+))|' + \ r'(?P<obj>(obj) (.+) (\S+) (\d+))|' + \ - r'(?P<sym>(sym) (.+) -> (.+) (\d+))' + \ + r'(?P<sym>(sym) (.+) -> (.+) ((\d+)|(?P<oldsym>(' + \ + '\(\d+, \d+L, \d+L, \d+, \d+, \d+, \d+L, \d+, (\d+), \d+\)))))' + \ r')$' ) @@ -1379,6 +1380,9 @@ class dblink(object): obj_index = contents_re.groupindex['obj'] dir_index = contents_re.groupindex['dir'] sym_index = contents_re.groupindex['sym'] + # The old symlink format may exist on systems that have packages + # which were installed many years ago (see bug #351814). + oldsym_index = contents_re.groupindex['oldsym'] # CONTENTS files already contain EPREFIX myroot = self.settings['ROOT'] if myroot == os.path.sep: @@ -1406,8 +1410,12 @@ class dblink(object): data = (m.group(base+1),) elif m.group(sym_index) is not None: base = sym_index + if m.group(oldsym_index) is None: + mtime = m.group(base+5) + else: + mtime = m.group(base+8) #format: type, mtime, dest - data = (m.group(base+1), m.group(base+4), m.group(base+3)) + data = (m.group(base+1), mtime, m.group(base+3)) else: # This won't happen as long the regular expression # is written to only match valid entries. |