diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-01-23 21:43:40 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-01-23 21:43:40 +0000 |
commit | ad51cdd88f82e58a16ffcaf0d72d17bb169a1e0e (patch) | |
tree | 300aac125d681e4bda4b4de25f5afb639023e651 | |
parent | bd367143c6b97c5e618451cfdde63babfaaaf2c0 (diff) | |
download | portage-ad51cdd88f82e58a16ffcaf0d72d17bb169a1e0e.tar.gz portage-ad51cdd88f82e58a16ffcaf0d72d17bb169a1e0e.tar.bz2 portage-ad51cdd88f82e58a16ffcaf0d72d17bb169a1e0e.zip |
For bug #142279, detect and warn about null bytes in CONTENTS. (trunk r5762:5763)
svn path=/main/branches/2.1.2/; revision=5764
-rw-r--r-- | pym/portage.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py index 667066597..f4d31a1ec 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6734,8 +6734,16 @@ class dblink: myc=open(self.dbdir+"/CONTENTS","r") mylines=myc.readlines() myc.close() + null_byte = "\0" + contents_file = os.path.join(self.dbdir, "CONTENTS") pos=1 for line in mylines: + if null_byte in line: + # Null bytes are a common indication of corruption. + writemsg("!!! Null byte found in contents " + \ + "file, line %d: '%s'\n" % (pos, contents_file), + noiselevel=-1) + continue mydat = line.split() # we do this so we can remove from non-root filesystems # (use the ROOT var to allow maintenance on other partitions) |