18

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.

8
  • 1
    There is at least one Linux distribution which is POSIX compliant, Inspur K-UX. Jun 2, 2019 at 4:44
  • 6
    @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.
    – S.S. Anne
    Jun 2, 2019 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, 2019 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.
    – S.S. Anne
    Jun 2, 2019 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. Jun 2, 2019 at 21:29

1 Answer 1

17

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.

6
  • Could someone easily get around this by just writing a cd program?
    – S.S. Anne
    Jun 2, 2019 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. Jun 2, 2019 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.
    – S.S. Anne
    Jun 2, 2019 at 4:54
  • 1
    Not that I know of, but maybe. At that level of specificity "unofficial" probably doesn't really cut it, though. Jun 2, 2019 at 5:02
  • 1
    What would a cd program even do? Change the directory and then exit? What would be the point? Apr 25, 2022 at 11:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .