🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.folklore.computers
Article #549

POSIX system() function (was: The end of software secrecy ...)

#549
From: Geoff Clare
Date: Thu, 29 Oct 2026 14:26
44 lines
3344 bytes
Scott Lurndal wrote:

> Prior to 2017, POSIX didn't require that the system function
> invoke a shell, simply that it would execute an implementation defined
> command string.  I must admit that I had pushed for the latter definition
> when part of the base working group for XPG5 (1994ish) (I was, at the time,
> working for Unisys for which POSIX support was being considered on the
> Large Systems line, which had no equivalent of the unix shell).

You are misremembering POSIX/XPG/SUS history. The following is from the
original POSIX.2-1992 standard (B.3.1.2 page 723):

    The system() function shall execute the command specified by the
    string pointed to by command. The environment of the executed
    command shall be as if a child process were created using the
    POSIX.1 {8} fork() function, and the child process invoked the sh
    utility (see 4.56) using the POSIX.1 {8} execl() function as follows:

    execl(<shell path>, "sh", "-c", command, (char ∗)0);

    where <shell path> is an unspecified pathname for the sh utility.

The same requirement was included in XPG4 and SUSv1 - SUSv4. In SUSv5
(POSIX.1-2024) it changed to:

    execl(<shell path>, "sh", "-c", "--", command, (char ∗)0);

so that if the command string begins with "-" it is not parsed as an
option string.

The only thing that was (and still is) unspecified is where the POSIX sh
utility is located (e.g. on Solaris it was /usr/xpg4/bin/sh).

Perhaps what you're thinking of is that in XPG4, SUSv1 and SUSv2 the
requirement was conditional on the "Commands and Utilities" volume (XCU)
of the standard being supported. It was possible to certify a system as
conforming to only the C language stuff (XSH) in which case calling
system(NULL) would return zero to indicate no command processor is
available if XCU was not supported. This changed in SUSv3 (2001) when
the conditional was removed and the requirement "The system() function
shall always return non-zero when command is NULL" was added.

-- 
Geoff Clare <netnews@gclare.org.uk>
Technical Details
Message-ID: <cm1crm-qfh.ln1@ID-313840.user.individual.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
References: <11amvre$15far$1@dont-email.me> <11bl9qm$10h8f$1@dont-email.me> <11bla34$fid$1@reader2.panix.com> <11blaui$2q6vd$1@dont-email.me> <11bldda$ba7$1@reader2.panix.com> <11bn7rn$2s5fj$1@dont-email.me> <20261026220433.00007818@yahoo.com> <11bsdv7$31fvn$1@dont-email.me> <20261028214746.00004151@yahoo.com> <QTsES.5149$ygZ5.4916@fx36.iad>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: Geoff Clare <geoff@clare.See-My-Signature.invalid>
Newsgroups: alt.folklore.computers
Subject: POSIX system() function (was: The end of software secrecy ...)
Date: Thu, 29 Oct 2026 14:26:52 +0000
Lines: 44
Message-ID: <cm1crm-qfh.ln1@ID-313840.user.individual.net>
References: <11amvre$15far$1@dont-email.me> <11bl9qm$10h8f$1@dont-email.me>
	<11bla34$fid$1@reader2.panix.com> <11blaui$2q6vd$1@dont-email.me>
	<11bldda$ba7$1@reader2.panix.com> <11bn7rn$2s5fj$1@dont-email.me>
	<20261026220433.00007818@yahoo.com> <11bsdv7$31fvn$1@dont-email.me>
	<20261028214746.00004151@yahoo.com> <QTsES.5149$ygZ5.4916@fx36.iad>
Reply-To: netnews@gclare.org.uk
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 0uTD3WkErg1FFRs0nDJ3uAinxLottgw/KlkgMmehjPpU6IDRua
X-Orig-Path: ID-313840.user.individual.net!not-for-mail
Cancel-Lock: sha1:xjAywVLBMRfFrTdtKt0ZvS25rWU= sha256:xY3Va61u5Dek/1N1zXc3kAIjgq6swQCQEDFtfOtrbBU=
User-Agent: Pan/0.154 (Izium; 517acf4)