[CentOS] Yum segmentation fault updating from 5.6 to 5.7

Wed Sep 14 21:56:22 UTC 2011
Sebastiano Pilla <sebastiano at datafaber.net>

I'm trying to update my CentOS 5.6 boxes to 5.7, and on every single one 
of them yum is failing with a segmentation fault: the error happens when 
yum is checking the 'base' repository.

[root at picard yum]# yum update
Loaded plugins: downloadonly, fastestmirror, priorities
Determining fastest mirrors
  * base: mirrors.ircam.fr
  * extras: mirrors.ircam.fr
  * updates: mirror.opendoc.net
base                                        | 1.1 kB     00:00
base/primary                                | 961 kB     00:00
Segmentation fault

Running yum under strace produces lots of output, the last lines are:

access("/var/cache/yum/base/primary.xml.gz.sqlite-journal", F_OK) = -1 
ENOENT (No such file or directory)
fstat64(5, {st_mode=S_IFREG|0644, st_size=20480, ...}) = 0
_llseek(5, 0, [0], SEEK_SET)            = 0
read(5, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\21\0\0\0\0"..., 1024) = 1024
_llseek(5, 2048, [2048], SEEK_SET)      = 0
read(5, 
"\r\0\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 
1024) = 1024
fcntl64(5, F_SETLK64, {type=F_UNLCK, whence=SEEK_SET, start=0, len=0}, 
0xbf86a1c4) = 0
futex(0x7ba0918, FUTEX_WAKE_PRIVATE, 2147483647) = 0
stat64("/var/cache/yum/base/primary.xml.gz", {st_mode=S_IFREG|0644, 
st_size=983757, ...}) = 0
stat64("/var/cache/yum/base/primary.xml.gz", {st_mode=S_IFREG|0644, 
st_size=983757, ...}) = 0
stat64("/var/cache/yum/base/primary.xml.gz", {st_mode=S_IFREG|0644, 
st_size=983757, ...}) = 0
open("/var/cache/yum/base/primary.xml.gz", O_RDONLY|O_LARGEFILE) = 6
_llseek(6, 0, [0], SEEK_CUR)            = 0
read(6, "\37\213\10\10\0\0\0\0\2\377/home/buildcentos/CENT"..., 8192) = 8192
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

It seems that the primary.xml.gz file is somehow corrupted, but I've 
already tried a "yum clean all" and a "rm -rf /var/cache/yum/*" without 
success.

Apart from being at CentOS 5.6 and all having this problem, the boxes 
have very few in common:

- 2 physical machine running 5.6 32-bit, one in my office, the other in 
a datacenter
- 1 physical machine running 5.6 64-bit in another datacenter
- 2 KVM VPS running 5.6 32-bit in a third datacenter
- 1 Xen VPS running 5.6 64-bit in a fourth datacenter

There was a thread on the forum some months ago which mentioned this 
same problem, but the original poster didn't find a solution (or if he 
did, he didn't share it with the forum). Any suggestion is appreciated, 
I cannot reinstall those boxes with 6.0 for at least 4/5 months.