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
74 stars 91 forks source link

Recover from fsync fail on read-only filesystem (RhBug:1956361) #245

Closed kontura closed 3 years ago

kontura commented 3 years ago

When fsync fails due to the file not supporting synchronization just log the problem instead of failing the whole dnf run. This happens for example with filesystems mounted read-only in which case there is no point to fsync anyway.

Currently we also ignore return values from FSETXATTR which also fails on read-only filesystem (so no checksum cache is set). This is fine however since the checksum is recomputed when needed, dnf is just a bit slower.

https://bugzilla.redhat.com/show_bug.cgi?id=1956361

@malmond77 can you take a look at this please?

remicollet commented 3 years ago

I confirm this patch fix the issue

Tested on Fedora 33 with librepo 1.14.0 + this patch and dnf 3.7.0 + mock 2.10.1

malmond77 commented 3 years ago

@kontura : this makes a lot of sense to me. Thanks for writing this!

pghmcfc commented 3 years ago

This bug is affecting me on Fedora 34 with dnf-4.7.0-1.fc34 and librepo-1.14.0-1.fc34; is there likely to be an update at some point to fix it?

kontura commented 3 years ago

@pghmcfc there will definitely be an update to F34 but it might take a while.

kontura commented 3 years ago

@pghmcfc there is https://bodhi.fedoraproject.org/updates/FEDORA-2021-3b74285c43 which contains new librepo with the fix.

pghmcfc commented 3 years ago

@pghmcfc there is https://bodhi.fedoraproject.org/updates/FEDORA-2021-3b74285c43 which contains new librepo with the fix.

Thanks, that works for me.