On 28/01/2022 01:49, Christoph Anton Mitterer wrote:
On Thu, 2022-01-27 at 17:07 +0000, Harald van Dijk via austin-group-l
at The Open Group wrote:
That is not what POSIX says. It says "The value of an environment
variable is a string of characters" (8.1 Environment Variable
Definition), and "character" is defined as "a sequence of one or more
bytes representing a single graphic symbol or control code" (3
Definitions), with a note that says it corresponds to what C calls a
multi-byte character. Environment variables are not specified to
allow
arbitrary bytes.
And later in the same chapter it says:
"These strings have the form name=value; names shall not contain the
character '='. For values to be portable across systems conforming to
POSIX.1-2017, the value shall be composed of characters from the
portable character set (except NUL and as indicated below)."
BUT...
further down it says:
"The values that the environment variables may be assigned are not
restricted except that they are considered to end with a null byte and
the total space used to store the environment and the arguments to the
process is limited to {ARG_MAX} bytes."
That is a good point. I don't have an answer here, this looks to me like
a contradiction in the standard.
Cheers,
Harald van Dijk