Defining an Env Descriptor

Zero or more Env descriptors can immediately follow the InfoHub descriptor, or start the configuration definition if the InfoHub descriptor is implicit; and zero or more Env descriptors can immediately follow any Publisher descriptor. Those in the first location define common environment variables for all processes used by the InfoHub; those in the second location define common environment variables for all PipeLine generated processes subject to that Publisher. The syntax of an Env Descriptor is:

Env:EnvVarName[=[Value]][,,,,] 

If the configuration processing encounters an Env descriptor that does not follow the InfoHub descriptor or a Publisher descriptor, it produces an IHENVPLACE error. There are three types of Env descriptor—one sets values in the environment of InfoHub processes, another with an equal-sign but no value ensures environment variables are not set (that is, cleared), and a third to invoke a shell script that manages the target environment. For example:

Attempting to configure an env descriptor without providing a suitable environment produces an IHBADENV error. Each EnvVarName is a legal POSIX environment variable name, consisting solely of ASCII letters, digits, and underscores ("_"), of which the first character must not be a digit; if configuration processing encounters a failure to meet this criterion, it also produces the IHBADENV error. To allow for permissible, non-graphic values[1] of environment variables, and to allow environment variables to reference environment variables of the InfoHub itself (using the $ZTRNLNM() function), each Value is treated as a GT.M expr that the InfoHub evaluates before storing the result in its database.

[Tip]InfoHub Internals

Configuration processing stores Env descriptor information in the following nodes:

^InfoHubConf(InfoHubID,"EnvSetUp",1,BeginningSequenceNumber)=​[EndingSquenceNumber]:​env=[value],..., where the string value of the node is constructed of shell commands that an InfoHub process uses to manage its environment.

^InfoHubConf(InfoHubID,"Publishers",PublisherID,BeginningSequenceNumber,​"EnvSetUp")​=[EndingSquenceNumber]:​env=[value],..., where the string value of the node is constructed of shell commands that a Publisher process uses to adjust the environment provided to it by its InfoHub to be appropriate for a PipeLine process.

Expression evaluation (implemented with indirection or XECUTE) also has the potential for side effects that can affect the InfoHub itself. To protect the InfoHub itself from side effects of evaluated expressions, the InfoHub processes Env descriptors in a routine which protects itself by:

  • setting $ZROUTINES to the null string to prevent any new routines from being linked;

  • creating a temporary global directory and database with $ZGBLDIR pointing there;

  • executing an exclusive NEW; and

  • receiving results in $ZTWORMHOLE, it being impossible to modify $ZTWORMHOLE as a side-effect of an expression. ($ZTWORMHOLE can itself be safely saved and restored in the calling routine to retain its originally intended use for triggers.)

Example:

Env:LC_TIME='fr_FR.UTF-8'
Env:LANG='en_US.utf-8'

Related Information:



[1] Quoting from IEEE Std 1003.1-2008: 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.