linux – Why are most Linux distributions not POSIX-compliant?

linuxposix

Why are most Linux distributions not POSIX-compliant? I've seen in lots of places that they're not (e.g. Mostly POSIX-compliant) but there's been no real explanation to back this up.

Is there something the C library and/or tools could do to get around this (i.e. no modifications to the kernel itself)? What needs to be done?

The supposed duplicate is asking which Linux distribution is POSIX-compliant; this is asking why most Linux distributions aren't POSIX-compliant. I'm asking for specific details (i.e. some function or command isn't compliant), not the reasons the specific distributions don't (try to) get certified.

This comment from @PhilipCouling (thanks!) explains it well:

Compliance and certification are different subjects. The answers point to cost of (re)certification which is irrelevant to the subject of (non)compliance.

Best Answer

POSIX does not specify a kernel interface, so Linux is largely irrelevant. It does specify the system interface, various tools, and extensions to the C standard, which could exist on top of any kernel. It is not POSIX-compliant in the sense that it's not mentioned, or it is POSIX-compliant in the sense that it's not mentioned, at your option.

There are UNIX®-Certified Linux distributions, so it is certainly possible to have fully POSIX-compliant operating systems using Linux. Huawei's EulerOS is one that has and that you can buy if you'd like. Most of the rest haven't paid their money and so don't have access to the test suite to check conformance.

Whether they would satisfy it in practice is not clear, but some do try harder than others. I suspect that some of the BSDs are closer than most Linux distributions, but that's a guess: for example, I know that execlp("cd", "/", NULL) fails on most Linux distributions, but works on many BSDs and is required by POSIX.