rpm-software-management / librepo

A library providing C and Python (libcURL like) API for downloading packages and linux repository metadata in rpm-md format
http://rpm-software-management.github.io/librepo/
GNU Lesser General Public License v2.1
75 stars 91 forks source link

Sync data before writing checksum xattr #211

Closed malmond77 closed 3 years ago

malmond77 commented 3 years ago

Writes to extended attributes are considered metadata, so can be commited to storage before data is fully synced. The upshot of this is that the checksum is cached but the file could be truncated. We attempt to sync data first to mitigate this problem.

This has been manifesting errors on real hosts with package {p} does not verify: Payload SHA256 digest: BAD (Expected {a} != {b}) because %_pkgverify_level = digest. On inspection the files are nearly full size, the xattr is present as if the full file were there. The mtime in the xattr matches the file.

Conan-Kudo commented 3 years ago

Merged, thanks for the patch!