On Tue, Feb 21, 2023 at 06:53:39PM +0100, Laszlo Ersek wrote: > > More in general, this lesson tells me that POSIX is effectively > irrelevant -- which is quite sad in itself; the bigger problem however > is that *nothing replaces it*. If the one formal standard we have for > portability does not reflect reality closely enough, and we need to rely > on personal experience with various platforms, then we're back to where > we were *before* POSIX. That is, having to check several separate > documentation sets, and testing each API on every relevant platform in > *each project* where the API is used. The idea is "ignore POSIX, care > about Linux / modern systems only", but then it turns out those modern > systems *do* differ sufficiently that extracting a common programming > base *would* be useful. It's just that POSIX is not that common base; > more precisely, there is no formalized, explicit common base. I guess > "whatever passes CI" is the common base. That's... terrible, and it > makes me seriously question if I want to program userspace in C at all.
FWIW, I wouldn't say that POSIX is irrelevant in general. If you are trying to maximimse portability it is worth paying attention to. Rather I'd say that maintainers of projects may be opinionated about which platforms they wish to support, to eliminate the burden of caring about platforms which have few if any users in the modern world. In libvirt and QEMU context we set explicit platform support targets: https://libvirt.org/platforms.html https://www.qemu.org/docs/master/about/build-platforms.html which effectively limit us to only care about actively developed OS from the last ~4 years, and even then only fairly mainstream stuff. We don't care about a hobbyist/toy UNIX OS. The burden is on other OS to attain compatibility with mainstream modern OS, not for apps to adapt to osbscure feature-poor platforms. With this attitude, we don't care about compliance with countless obsolete vendor's UNIX platforms, and thus many of the edge cases that POSIX worries about can be ignored. This frees the project maintainers time to focus on work that benefits a broader set of users. >From this, libvirt/QEMU could both explicitly decide to not care about any C compilers other than CLang/GCC. Vendor compilers and most especially MSVC are out of scope. CLang/GCC are able to support any of the OS platforms we target. This frees us from caring about ISO C standards, letting us use GNU extensions. AFAIK, libnbd/nbdkit haven't made a statement about what platforms they aim to target. In my response I'm more or less assuming though that you would only care about similar modern platforms to QEMU/libvirt, and thus POSIX conformance would not be needed in all areas. Maybe libnbd/nbdkit want to be more explicit about what they target as platforms to make the portability requirements clear to contributors ? With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs