FS#35789 - "wrong or NULL argument passed" with an incorrect "*.part" file

Attached to Project: Pacman
Opened by Roman Beslik (beroal) - Friday, 14 June 2013, 16:48 GMT
Last edited by Allan McRae (Allan) - Friday, 13 December 2019, 14:09 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Allan McRae (Allan)
Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version 4.1.1
Due in Version 6.0.0
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Summary and Info:
I guess that in rare cases (e.g. a broken mirror), a "*.part" file may have the size >= the size of the correct package file. In this case, Pacman reports "error: failed to commit transaction (wrong or NULL argument passed)". It neither reports the name of this file nor checks the correctness of this file. When running "pacman -Su", I don't know which file is problematic. Full logs:
0) http://www.beroal.in.ua/prg/linux/pacman-part-cache.log
1) with the option "--debug" - http://www.beroal.in.ua/prg/linux/pacman-part-cache-debug.log

Steps to Reproduce:
Let P be some package, V be its latest version.
0. Downgrade P.
1. Rename "$P-$V" to "$P-$V.part" in "/var/cache/pacman/pkg".
2. Run "pacman $P".
3. Observe the error message.

pacman 4.1.1-1
This task depends upon

Closed by  Allan McRae (Allan)
Friday, 13 December 2019, 14:09 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit e6a6d307
Comment by Doug Newgard (Scimmia) - Tuesday, 05 January 2016, 18:31 GMT
Possibly related: https://bbs.archlinux.org/viewtopic.php?id=207185

I know it's come up other times on the forums as well.
Comment by Norbert Pfeiler (npfeiler) - Wednesday, 15 March 2017, 15:06 GMT
without --debug only the (pretty unhelpful) last 2 lines are printed

only http mirrors were used

sudo pacman -Syu --debug (Pacman v5.0.1 - libalpm v10.0.1)

debug: found cached pkg: /var/cache/pacman/pkg/lib32-glibc-2.25-1-x86_64.pkg.tar.xz.part
debug: using (package - .part) size
debug: setting download size 0 for pkg lib32-glibc
[…]
debug: found cached pkg: /var/cache/pacman/pkg/glibc-2.25-1-x86_64.pkg.tar.xz
debug: sig data: iQFIBAABCAAyFiEEZkWwqMcAXnjbHXhk+Z/+D+rpmb0FAli+GJgUHGFsbGFuQGFyY2hsaW51eC5vcmcACgkQ+Z/+D+rpmb3A7Af9F09FYEJ9eXhwjKN1uugYvHQlWsRJTe6GLkbinhixofIr7uM3Mpz+IXSnAacGLkSOXGpCf98emGOh+UTCgMxZcVUOtAFnt77ykOQq0sUByA/8e+ucrwh4nVgNGDbYEQuAnnnuF6pAok8e+sdpmr04G7eSosswGyI0R3sMhjF57tYX7Zda7uTcblEqKhEJ/vcT1HgYC3+VJQLzrwTEjOI1i0qzx87Gzy1WdZoNSkNFJWpzwCoYJ3JCtSo775iFwa/Kjzfh7wSZf40y8lP+ZRR0H0qmeYsrMygqbyBcndU6db7vgtm8PSpCbpCO37WON8dl07zjxPQHIdRByqueD2ZXzQ==
debug: checking signature for /var/cache/pacman/pkg/glibc-2.25-1-x86_64.pkg.tar.xz
debug: 1 signatures returned
debug: fingerprint: 6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD
debug: summary: valid
debug: summary: green
debug: status: Success
debug: timestamp: 1488853144
debug: exp_timestamp: 0
debug: validity: full; reason: Success
debug: key: 6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD, Allan McRae <me@allanmcrae.com>, owner_trust unknown, disabled 0
debug: signature is valid
debug: signature is fully trusted
debug: returning error 6 from _alpm_pkg_validate_internal : wrong or NULL argument passed
[…]
debug: returning error 34 from check_validity : invalid or corrupted package
error: failed to commit transaction (invalid or corrupted package)
Errors occurred, no packages were upgraded.
Comment by Allan McRae (Allan) - Friday, 15 November 2019, 00:48 GMT
Just adding a note. If a good package follows the .part one, you do not get the "wrong or NULL argument passed" output. Just that there was an invalid package.
Comment by Allan McRae (Allan) - Friday, 15 November 2019, 13:47 GMT

Loading...