FS#14914 - Local DB corruption- duplication in DB files

Attached to Project: Pacman
Opened by Dan McGee (toofishes) - Tuesday, 02 June 2009, 01:40 GMT
Last edited by Dan McGee (toofishes) - Tuesday, 02 June 2009, 12:28 GMT
Task Type Bug Report
Category Backend/Core
Status Closed
Assigned To No-one
Architecture All
Severity Critical
Priority Normal
Reported Version git
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I haven't filed a pacman bug in a long time, but this one is a good one. :)

$ pacman -Qs initscripts
local/initscripts 2009.03-2 (base base base base)
System initialization/bootup scripts

Hmm, that is quite interesting. How does that happen? The database files all contain 4x the information. I've attached the 'desc' file for initscripts; the 'files' file has the same problem. Interestingly enough, 'depends' does not.

This is not the only package on my system that is all weird. At least these ones are broken as well (obvious because of the groups duplication):
$ pacSs . | grep 'base base'
***local/initscripts 2009.03-2 (base base base base)
***local/pam 1.0.4-1 (base base base base)
***local/syslog-ng 3.0.1-6 (base base base)
***local/util-linux-ng 2.14.2-1 (base base)


And more info:

$ cat /var/log/pacman.log | grep initscripts
[2008-10-20 17:30] installed initscripts (2008.09-2)
[2009-01-22 22:06] upgraded initscripts (2008.09-2 -> 2009.01-1)
[2009-03-08 16:54] upgraded initscripts (2009.01-1 -> 2009.03-1)
[2009-03-15 10:32] upgraded initscripts (2009.03-1 -> 2009.03-2)

$ ll /var/lib/pacman/local/initscripts-2009.03-2/
total 88K
-rw-r--r-- 1 root root 73K 2009-03-10 16:08 changelog
-rw-r--r-- 1 root root 222 2009-03-15 10:32 depends
-rw-r--r-- 1 root root 1.1K 2009-03-15 10:32 desc
-rw-r--r-- 1 root root 2.0K 2009-03-15 10:32 files
   desc (1.1 KiB)
This task depends upon

Closed by  Dan McGee (toofishes)
Tuesday, 02 June 2009, 12:28 GMT
Reason for closing:  Not a bug
Additional comments about closing:  Local code changes only, so all my fault. Allan *didn't* break it!
Comment by Allan McRae (Allan) - Tuesday, 02 June 2009, 02:03 GMT
Can you create the behaviour once this corruption has started? i.e. reinstall initscripts and does it keep four entries, add an extra one, or go back to good? At least all the entries are for the one version...
Comment by Dan McGee (toofishes) - Tuesday, 02 June 2009, 02:46 GMT
dmcgee@galway ~
$ pacman -Qs util-linux-ng
local/util-linux-ng 2.14.2-1 (base base)
Miscellaneous system utilities for Linux

dmcgee@galway ~
$ sudo pacman -S util-linux-ng
Password:
warning: util-linux-ng-2.14.2-1 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): util-linux-ng-2.14.2-1

Total Download Size: 0.00 MB
Total Installed Size: 5.25 MB

Proceed with installation? [Y/n] y
checking package integrity...
(1/1) checking for file conflicts [#####################] 100%
(1/1) upgrading util-linux-ng [#####################] 100%

dmcgee@galway ~
$ pacman -Qs util-linux-ng
local/util-linux-ng 2.14.2-1 (base)
Miscellaneous system utilities for Linux
Comment by Dan McGee (toofishes) - Tuesday, 02 June 2009, 02:47 GMT
So yeah, it goes back to good. Sorry for not stating that explicitly.
Comment by Allan McRae (Allan) - Tuesday, 02 June 2009, 03:03 GMT
So, there is a possibility that this bug been introduced and then fixed. Can you limit a time period when this was occurring by looking at the install date of broken packages? In particular, when did the most recent breakage occur?
Comment by Dan McGee (toofishes) - Tuesday, 02 June 2009, 03:06 GMT
$ cat /var/log/pacman.log | grep -E '(initscripts|pam|syslog-ng|util-linux-ng)'
[2008-10-20 17:30] installed util-linux-ng (2.14-1)
[2008-10-20 17:30] installed initscripts (2008.09-2)
[2008-10-20 17:30] installed syslog-ng (2.0.9-1)
[2008-10-24 19:35] * imap : pam
[2008-12-12 21:54] warning: /etc/syslog-ng.conf installed as /etc/syslog-ng.conf.pacnew
[2008-12-12 21:54] upgraded syslog-ng (2.0.9-1 -> 2.1.3-2)
[2009-01-15 19:16] upgraded pam (1.0.2-2 -> 1.0.3-1)
[2009-01-22 22:06] upgraded initscripts (2008.09-2 -> 2009.01-1)
[2009-03-08 16:54] upgraded initscripts (2009.01-1 -> 2009.03-1)
[2009-03-08 16:55] warning: /etc/syslog-ng.conf installed as /etc/syslog-ng.conf.pacnew
[2009-03-08 16:55] Attention syslog-ng update:
[2009-03-08 16:55] Configuration file syntax has changed. Make sure to update /etc/syslog-ng.conf
[2009-03-08 16:55] upgraded syslog-ng (2.1.3-2 -> 3.0.1-4)
[2009-03-15 10:32] upgraded initscripts (2009.03-1 -> 2009.03-2)
[2009-03-15 10:32] upgraded pam (1.0.3-1 -> 1.0.4-1)
[2009-03-15 10:32] upgraded syslog-ng (3.0.1-4 -> 3.0.1-6)
[2009-03-15 10:32] upgraded util-linux-ng (2.14-1 -> 2.14.2-1)
[2009-06-01 21:45] upgraded util-linux-ng (2.14.2-1 -> 2.14.2-1)

Something funny clearly happened on that 2009-03-15 update. It wasn't a particularly huge one:
[2009-03-15 10:23] synchronizing package lists
[2009-03-15 10:23] starting full system upgrade
[2009-03-15 10:32] upgraded libcap (1.10-2 -> 2.16-2)
[2009-03-15 10:32] upgraded avahi (0.6.24-1 -> 0.6.24-2)
[2009-03-15 10:32] upgraded cdrkit (1.1.9-1 -> 1.1.9-2)
[2009-03-15 10:32] upgraded device-mapper (1.02.30-1 -> 1.02.31-1)
[2009-03-15 10:32] upgraded devil (1.7.7-2 -> 1.7.8-1)
[2009-03-15 10:32] The package is built using sysv ipc. If this causes segfaults
[2009-03-15 10:32] see included README file and rebuild the pkg --with-ipc=tcp
[2009-03-15 10:32] upgraded fakeroot (1.12.1-1 -> 1.12.2-2)
[2009-03-15 10:32] upgraded gstreamer0.10 (0.10.21-2 -> 0.10.22-1)
[2009-03-15 10:32] upgraded gstreamer0.10-base (0.10.21-1 -> 0.10.22-1)
[2009-03-15 10:32] upgraded initscripts (2009.03-1 -> 2009.03-2)
[2009-03-15 10:32] upgraded lvm2 (2.02.44-1 -> 2.02.45-1)
[2009-03-15 10:32] upgraded mysql (5.0.77-1 -> 5.0.77-2)
[2009-03-15 10:32] upgraded pam (1.0.3-1 -> 1.0.4-1)
[2009-03-15 10:32] upgraded pidgin (2.5.4-1 -> 2.5.5-1)
[2009-03-15 10:32] upgraded pinentry (0.7.5-3 -> 0.7.5-4)
[2009-03-15 10:32] upgraded pmount (0.9.19-1 -> 0.9.19-2)
[2009-03-15 10:32] upgraded pygtk (2.14.0-1 -> 2.14.1-1)
[2009-03-15 10:32] upgraded qt (4.5.0-1 -> 4.5.0-3)
[2009-03-15 10:32] upgraded qgit (2.2-1 -> 2.2-2)
[2009-03-15 10:32] upgraded tdb (3.3.1-1 -> 3.3.2-1)
[2009-03-15 10:32] upgraded smbclient (3.3.1-1 -> 3.3.2-1)
[2009-03-15 10:32] upgraded syslog-ng (3.0.1-4 -> 3.0.1-6)
[2009-03-15 10:32] upgraded util-linux-ng (2.14-1 -> 2.14.2-1)
[2009-03-15 10:32] installed adns (1.4-1)
[2009-03-15 10:32] upgraded wireshark (1.0.6-1 -> 1.0.6-2)

It is hard to tell what version of pacman I was using when that upgrade happened, as I might have been running it out of my source tree. :/
Comment by Allan McRae (Allan) - Tuesday, 02 June 2009, 03:49 GMT
I can not seen any relevant commits anywhere around that time. Maybe this never made it to master.
Comment by Xavier (shining) - Tuesday, 02 June 2009, 08:11 GMT
This is around the time you played with fsync stuff :
http://www.archlinux.org/pipermail/pacman-dev/2009-March/008439.html

Interesting coincidence? :)
Comment by Dan McGee (toofishes) - Tuesday, 02 June 2009, 12:27 GMT
Xavier wins! The power of the git-reflog:

$ git reflog --date=local
...
933f820 HEAD@{Sun Mar 15 10:48:51 2009}: commit: Reduce number of open()/close() calls on the DB file handle
f623dba HEAD@{Sun Mar 15 10:39:25 2009}: commit (amend): libalpm: sync changes to disk when appropriate
44ce526 HEAD@{Fri Mar 13 21:42:44 2009}: commit (amend): libalpm: sync changes to disk when appropriate
00265fc HEAD@{Fri Mar 13 21:21:00 2009}: commit (amend): libalpm: sync changes to disk when appropriate
e830879 HEAD@{Fri Mar 13 21:18:51 2009}: commit (amend): libalpm: sync changes to disc when appropriate
0b1853f HEAD@{Fri Mar 13 20:52:27 2009}: commit: libalpm: sync changes to disc when appropriate

So I definitely did something funky in my playing around with that patch, and that would have been the branch I had checked out at the time. Thanks for digging around for that, that makes a lot more sense.

Loading...