On Sat, Apr 19, 2025 at 10:55:20PM +0800, Sean Whitton wrote:
This just hasn't been my experience. You don't need perfect compatibility (or certification). By restricting myself to the POSIX specifications of sh, awk, find, grep and sed, I've profitably written several non-trivial programs that work correctly on any FreeBSD install and any Debian install that wasn't specifically engineered to be minimal.
You happened to pick two of the most compatible OSs--it's not hard to be portable between linux & freebsd *by accident* as there's a long history of cross-pollination between them. (E.g., coreutils routinely looks to see what parameters freebsd used when implementing a new feature.) Expand the problem set to include running on SunOS and AIX and OSX and QNX and ... and the problem becomes much harder. But if you don't care about all those oddballs, why limit yourself to POSIX--whose point was to try to enable that degree of cross-platform interoperability? Stick to the intersection between linux + freebsd and you instantly get access to all kinds of wonderful modern things like mktemp without having to wait for POSIX to tell you it's ok. Conversely, if you expect POSIX from debian you're going to be disappointed now and then. E.g., POSIX gave up on trying to unify all the incompatible versions of tar/cpio and created a new standard archive utility named pax. Which works fine on many non-certified but POSIX-curious OSs like FreeBSD, OSX, OpenIndiana, etc etc, but you won't find it on a standard debian install. It's just one of those things where regardless of what standard you are writing to, you still need to check to see how reality matches the standard.