martinpitt / umockdev

Mock hardware devices for creating unit tests and bug reporting
https://launchpad.net/umockdev
GNU Lesser General Public License v2.1
308 stars 54 forks source link

preload: wrap fstatfs() and statfs() on musl #224

Closed alyssais closed 7 months ago

alyssais commented 7 months ago

musl has both of these functions (though not the separate "64" variants that glibc), and since systemd 251, a wrapped fstatfs() is required for udevmock's own test suite to pass, unless SYSTEMD_DEVICE_VERIFY_SYSFS is set to 0.

martinpitt commented 7 months ago

Thanks! But why did you move that code? First of all, it makes it very hard to see what actually changed (I don't see the musl fix, for example), and second it's now in a wrong place. If you want to move the code for aesthetic reasons, please do that as a separate commit, and then one with just the musl fix. Cheers!

alyssais commented 7 months ago

I didn't move it for aesthetic reasons, I moved it so it wasn't in the #ifdef __GLIBC__. Because I moved most of the code that was previously in there out, the way GitHub renders the diff is the #ifdef moving rather than the code that was previously inside it, as that results in a smaller diff.

martinpitt commented 7 months ago

I see, thanks. However, I still don't like ripping apart the fstatfs{,64} and statfs{,64} declarations like that, they should stay together -- with the 64 variants being ifdeff'ed for glibc. I sent PR #225 with what I had in mind, which passes tests and seems to work well. If you care at all about having your name in "Author:" instead of just the commit message, please feel free to grab that diff, massage it a little bit if you like, and push it here -- I'm totally fine with that :grin: