FS#24518 - pacman calls a package corrupted even though md5sums are a match

Attached to Project: Pacman
Opened by John (graysky) - Tuesday, 31 May 2011, 07:55 GMT
Last edited by Dan McGee (toofishes) - Wednesday, 08 June 2011, 21:30 GMT
Task Type Bug Report
Category Backend/Core
Status Closed
Assigned To No-one
Architecture All
Severity High
Priority Normal
Reported Version 3.5.2
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Summary and Info: I maintain an unofficial repo for kernel26-ck. Pacman seems to flag a package as corrupted despite the fact that the md5sum for the file is identical both within the repo.db.tar.gz, and in the downloaded file on the filesystem in /var/cache/pacman/pkg

On my local disk:

$ md5sum nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz
da24306220bda05db5a2ca2fe1d9fc6d nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz

In kernel26-ck.db.tar.gz for i686:

%MD5SUM%
da24306220bda05db5a2ca2fe1d9fc6d

When I download it from the repo:

$ sudo pacman -S nvidia-ck-core2
warning: nvidia-ck-core2-270.41.19-2 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (1): nvidia-ck-core2-270.41.19-2

Total Download Size: 3.60 MB
Total Installed Size: 3.71 MB

Proceed with installation? [Y/n]
:: Retrieving packages from kernel26-ck...
nvidia-ck-core2-270.41.19-2-i686 3.6M 835.1K/s 00:00:04 [########################################] 100%
:: File nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz is corrupted. Do you want to delete it? [Y/n] n---------------] 0%
(1/1) checking package integrity [########################################] 100%
error: failed to commit transaction (invalid or corrupted package)
nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz is invalid or corrupted
Errors occurred, no packages were upgraded.

But the md5sum of the freshly downloaded package IS correct in cache:

$ md5sum /var/cache/pacman/pkg/nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz
da24306220bda05db5a2ca2fe1d9fc6d /var/cache/pacman/pkg/nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz

Steps to Reproduce:

This only seems to happen for a single package in the i686 arch so do this from an i686 chroot or machine:

1) Add my repo to your /etc/pacman.conf

[kernel26-ck]
Server = http://home.comcast.net/~repo-ck/$arch

2) Try to install the nvidia-ck-core2 package via pacman -S nvidia-ck-core2
This task depends upon

Closed by  Dan McGee (toofishes)
Wednesday, 08 June 2011, 21:30 GMT
Reason for closing:  Not a bug
Additional comments about closing:  See last comment
Comment by John (graysky) - Tuesday, 31 May 2011, 08:03 GMT
Attached is the db tarball I generated with the repo-add script.

I just noticed that for some reason, the md5sum for the package is DIFFERENT when I inspect /var/lib/pacman/sync/kernel26-ck.db

-----

%FILENAME%
nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz

%NAME%
nvidia-ck-core2

%VERSION%
270.41.19-2

%DESC%
NVIDIA drivers for kernel26-ck.

%GROUPS%
ck-core2

%CSIZE%
3776244

%ISIZE%
3891200

%MD5SUM%
da24306220bda05db5a2ca2fe1d9fc6d

%URL%
http://www.nvidia.com/

%LICENSE%
custom

%ARCH%
i686

%BUILDDATE%
1306827343

%PACKAGER%
graysky <graysky@archlinux.us

-----
Comment by Dan McGee (toofishes) - Tuesday, 31 May 2011, 14:35 GMT
pacman doesn't use .db.tar.gz files anymore- run pacman -Sc to clean those up (via the second question, you can answer no to the first).

Once you've done that, please attach only the kernel26-ck.db file downloaded by pacman; your linked URL is not working above.
Comment by John (graysky) - Tuesday, 31 May 2011, 19:51 GMT
Thanks for the info, Dan.

The link is in the format suitable for inclusion in /etc/pacman.conf - here is a simple web based interface to grab the files via a browser.
http://home.comcast.net/~repo-ck/

Attached is kernel26-ck.db per your request.
Comment by Dan McGee (toofishes) - Tuesday, 31 May 2011, 20:07 GMT
So I'm not seeing the problems you are seeing at all- my package shows the correct da243 md5sum. Can you post a similar bit to what I have below from your system?

sudo pacman -Swdd --debug nvidia-ck-core2
...
debug: found cached pkg: /var/cache/pacman/pkg/nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz
debug: setting download size 0 for pkg nvidia-ck-core2

Targets (1): nvidia-ck-core2-270.41.19-2

Total Download Size: 0.00 MB

Proceed with download? [Y/n] y
debug: using cachedir: /var/cache/pacman/pkg/
checking package integrity...
debug: found cached pkg: /var/cache/pacman/pkg/nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz
debug: md5(/var/cache/pacman/pkg/nvidia-ck-core2-270.41.19-2-i686.pkg.tar.xz) = da24306220bda05db5a2ca2fe1d9fc6d
debug: replacing pkgcache entry with package file for target nvidia-ck-core2
...
Comment by Dan McGee (toofishes) - Tuesday, 07 June 2011, 16:12 GMT
Closing this out if no response in a few more days.
Comment by John (graysky) - Wednesday, 08 June 2011, 21:11 GMT
Dan - it's happening again with a new file.

http://pastebin.com/Q149SsLS
Comment by Dan McGee (toofishes) - Wednesday, 08 June 2011, 21:30 GMT
Mind telling me exactly what you expect to happen when I see the following?

$ bsdtar xOf kernel26-ck.db kernel26-ck-k8-headers-1:2.6.39.1-1/desc | grep -A1 MD5SUM
%MD5SUM%
e005db9270d59e0bac324613a69fb1a2

$ md5sum kernel26-ck-k8-headers-1\:2.6.39.1-1-x86_64.pkg.tar.xz
9d0bd2150a94cfd6c3403acd04a5a390 kernel26-ck-k8-headers-1:2.6.39.1-1-x86_64.pkg.tar.xz

Those don't match, you lose, and so does pacman. Now why does this happen?

$ wget http://home.comcast.net/~repo-ck/x86_64/kernel26-ck.db
$ wget http://home.comcast.net/~repo-ck/x86_64/kernel26-ck.db.tar.gz
$ md5sum kernel26-ck.db*
59ac7bb0e6a284a094b7556a655ab2bb kernel26-ck.db
e9059d187babb8f783027cb0038d35d9 kernel26-ck.db.tar.gz

If those files aren't the same, your repo is set up incorrectly, and there is nothing we can do. Pacman *only* looks for a .db file these days, the .db.tar.gz is to preserve compatibility with old versions.
Comment by John (graysky) - Wednesday, 08 June 2011, 21:59 GMT
thanks... it was the symlink that f*cked-up my stuff. Apparently the lftp wasn't handling it properly. I'm good now.

Loading...