On Fri, Apr 18, 2025 at 02:52:17PM +0800, Sean Whitton wrote:
On Thu 17 Apr 2025 at 08:02pm -05, Richard Laager wrote:
So, personally, I think getting mktemp(1) added to POSIX would be
better for portability in the long run anyway.
Eventually. POSIX.1-2017 is going to be the thing to target for a long
time, I think.
I think POSIX is mostly a relic, and not worth worrying about except as
one of many inputs. Too many mistakes were made too early on, and it's
just too late to get everyone to agree on a common standard because real
world implementations diverged in too many ways. If someone wants to
make a program that works reliably across platforms sh isn't the right
tool in 2025. (And I say that as someone who quotes POSIX regularly: it
has value for things like choosing amongst a set of possible
implementations, but not for making assumptions about what will work in
the real world.)
GNU m4 doesn't follow POSIX strictly, unfortunately.
Very few things do. POSIX itself has been trying harder to reflect
reality in areas where nobody wanted to follow the standard, but then
you're left with the problem that there's no straightforward way to
discover which version of the standard a particular tool is using.
See these workarounds for both the potential lack of m4 and the lack of
GNU m4 behaving POSIXly:
I'm curious what modern platform doesn't have mktemp; is this more than
an academic question?