diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-01-23 21:38:58 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-01-23 21:38:58 +0000 |
commit | 2f71a6b059e1e411dd1d3d7455ba974b9ac714e3 (patch) | |
tree | 2c3b4995a4f0f865c552446c550a0c2ad0d431c1 | |
parent | e3b5ad533792b5708b0bd2d121aa353bcc28b1a7 (diff) | |
download | portage-2f71a6b059e1e411dd1d3d7455ba974b9ac714e3.tar.gz portage-2f71a6b059e1e411dd1d3d7455ba974b9ac714e3.tar.bz2 portage-2f71a6b059e1e411dd1d3d7455ba974b9ac714e3.zip |
For bug #142279, detect and warn about null bytes in CONTENTS.
svn path=/main/trunk/; revision=5763
-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 b434b338e..eb44be8aa 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6799,8 +6799,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) |