6

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.

  • 1
    There is at least one Linux distribution which is POSIX compliant, Inspur K-UX. – Stephen Kitt Jun 2 at 4:44
  • 5
    @Gilles This is not a duplicate; the supposed duplicate is asking which Linux distro is POSIX-compliant; this is asking why Linux isn't POSIX-compliant. – JL2210 Jun 2 at 17:37
  • @JL2210, the second sentence of the duplicate is "What are the primary reasons that most distributions don't get certified?" and answers there address that. – Jeff Schaller Jun 2 at 18:06
  • 1
    @JeffSchaller I'm asking for specific details (i.e. some function or command isn't compliant), not the reasons they don't try to get certified. – JL2210 Jun 2 at 18:20
  • 3
    @JeffSchaller Compliance and certification are different subjects. The answers point to cost of (re)certification which is irrelevant to the subject of (non)compliance. – Philip Couling Jun 2 at 21:29
6

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.

  • Could someone easily get around this by just writing a cd program? – JL2210 Jun 2 at 4:52
  • Sure, but it's unlikely that that's the only deviation, it's just an easy gratuitous compliance check I know off the top of my head. All of them are resolvable if someone made the effort. – Michael Homer Jun 2 at 4:53
  • 1
    Is there any unofficial test suite? I was sort of hoping to test my C library for conformance; the POSIX standard seems a bit ambiguous on a few functions. – JL2210 Jun 2 at 4:54
  • 1
    Not that I know of, but maybe. At that level of specificity "unofficial" probably doesn't really cut it, though. – Michael Homer Jun 2 at 5:02
  • Fair warning: This is mainly an answer to the question because of the last paragraph, but if someone comes along with more details about deviations (as you put it), I may accept their answer instead. – JL2210 Dec 6 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.