aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS46
-rw-r--r--configure.ac2
-rw-r--r--doc/pies.texi212
-rw-r--r--lib/envop.c14
-rw-r--r--lib/envop.h2
-rw-r--r--src/pies.c10
-rw-r--r--src/progman.c7
-rw-r--r--tests/env.at72
-rw-r--r--tests/envop.at23
9 files changed, 361 insertions, 27 deletions
diff --git a/NEWS b/NEWS
index f34a6f0..db79097 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,10 @@
1GNU Pies NEWS -- history of user-visible changes. 2019-05-31 1GNU Pies NEWS -- history of user-visible changes. 2019-06-03
2See the end of file for copying conditions. 2See the end of file for copying conditions.
3 3
4Please send Pies bug reports to <bug-pies@gnu.org> or 4Please send Pies bug reports to <bug-pies@gnu.org> or
5<bug-pies@gnu.org.ua> 5<bug-pies@gnu.org.ua>
6 6
7Version 1.3.90 (git) 7Version 1.3.91 (git)
8 8
9* New option --no-init 9* New option --no-init
10 10
@@ -38,7 +38,41 @@ contains redirections, pipes, etc. E.g.
38 38
39* Improved cyclic dependency diagnostics 39* Improved cyclic dependency diagnostics
40 40
41* Fix a bug in 'env' statement 41* New 'env' statement
42
43The 'env' statement has been re-implemented as a compound statement.
44It can contain the following sub-statements:
45
46** clear yes
47Clears the environment
48
49** keep NAME
50Keeps the variable NAME when clearing the environment. Implies
51"clear yes". NAME can be a globbing pattern, in which case all
52variables matching the pattern are retained.
53
54** set "NAME=VALUE"
55Sets the environment variable for the component. VALUE is subject
56to variable expansion.
57
58** unset NAME
59Unsets the variable. NAME can be a globbing pattern, in which case all
60variables matching the pattern are unset.
61
62Example:
63
64 env {
65 clear yes
66 keep PATH
67 keep MANPATH
68 keep "LC_*"
69 set "MANPATH=$MANPATH${MANPATH:+:}/usr/local/man"
70 }
71
72* Legacy 'env' statement.
73
74Support for the old one-line syntax of "env" is retained for
75backward compatibility.
42 76
43Previous versions applied unnecessary word splitting if given a 77Previous versions applied unnecessary word splitting if given a
44single argument. This is now fixed, so that e.g. the following 78single argument. This is now fixed, so that e.g. the following
@@ -47,6 +81,12 @@ X to have the value "foo bar":
47 81
48 env "X=foo bar" 82 env "X=foo bar"
49 83
84* New environment variable available in commands started from return-code
85
86Programs started via "exec" statement in the "return-code" block
87obtain the PID of the master pies process in environment variable
88PIES_MASTER_PID.
89
50 90
51Version 1.3, 2016-10-01 91Version 1.3, 2016-10-01
52 92
diff --git a/configure.ac b/configure.ac
index a3c0b34..ccfd9fc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -15,7 +15,7 @@
15# along with GNU Pies. If not, see <http://www.gnu.org/licenses/>. 15# along with GNU Pies. If not, see <http://www.gnu.org/licenses/>.
16 16
17AC_PREREQ([2.63]) 17AC_PREREQ([2.63])
18AC_INIT([GNU Pies], [1.3.90], [bug-pies@gnu.org.ua]) 18AC_INIT([GNU Pies], [1.3.91], [bug-pies@gnu.org.ua])
19AC_CONFIG_SRCDIR([src/pies.h]) 19AC_CONFIG_SRCDIR([src/pies.h])
20AC_CONFIG_AUX_DIR([build-aux]) 20AC_CONFIG_AUX_DIR([build-aux])
21AC_CONFIG_HEADERS([config.h]) 21AC_CONFIG_HEADERS([config.h])
diff --git a/doc/pies.texi b/doc/pies.texi
index b77a40c..ccb9f0e 100644
--- a/doc/pies.texi
+++ b/doc/pies.texi
@@ -122,6 +122,7 @@ Component Statement
122* Prerequisites:: 122* Prerequisites::
123* Component Privileges:: 123* Component Privileges::
124* Resources:: 124* Resources::
125* Environment::
125* Actions Before Startup:: 126* Actions Before Startup::
126* Exit Actions:: 127* Exit Actions::
127* Output Redirectors:: 128* Output Redirectors::
@@ -712,7 +713,7 @@ compatibility with the @sc{c} preprocessor.
712@end table 713@end table
713 714
714@node Component Statement 715@node Component Statement
715@section Component Statement 716@section The @code{component} Statement
716@kwindex component 717@kwindex component
717 718
718@deffn {Config} component 719@deffn {Config} component
@@ -937,6 +938,7 @@ substatements.
937* Prerequisites:: 938* Prerequisites::
938* Component Privileges:: 939* Component Privileges::
939* Resources:: 940* Resources::
941* Environment::
940* Actions Before Startup:: 942* Actions Before Startup::
941* Exit Actions:: 943* Exit Actions::
942* Output Redirectors:: 944* Output Redirectors::
@@ -1038,7 +1040,122 @@ Set the umask. The @var{number} must be an octal value not greater
1038than @samp{777}. The default umask is inherited at startup. 1040than @samp{777}. The default umask is inherited at startup.
1039@end deffn 1041@end deffn
1040 1042
1041@deffn {Config: component} env @var{args} 1043@deffn {Config: component} max-instances @var{n}
1044Sets the maximum number of simultaneously running instances of this
1045component.
1046@end deffn
1047
1048@node Environment
1049@subsection Environment
1050Normally all components inherit the environment of the master
1051@command{pies} process. You can modify this environment using
1052the @code{env} statement. It has two variants: @dfn{compound} and @dfn{legacy}.
1053The legacy one-line statement was used in @command{pies} versions
1054up to 1.3 and is still retained for backward compatibility. It is
1055described in @ref{env legacy syntax}. This subsection describes the
1056modern compount syntax.
1057
1058@deffn {Config: component} env @{ ... @}
1059The compound @code{env} statement has the following syntax:
1060
1061@example
1062@group
1063env @{
1064 clear @var{bool};
1065 keep @var{pattern};
1066 set "@var{name}=@var{value}";
1067 unset @var{pattern};
1068@}
1069@end group
1070@end example
1071@end deffn
1072
1073Statements inside the @code{env} block define operations that
1074modify the environment. The @code{clear} and @code{keep} statements
1075are executed first. Then, the @code{set} and @code{unset} statements
1076are applied in the order of their appearance in the configuration.
1077
1078@deffn {env} clear @var{bool}
1079If @var{bool} is @samp{yes}, all environment variables will be cleared
1080(unset). The resulting environment will be empty, unless one or more
1081@code{keep} statements are also given (see below). The @code{clear}
1082statement is always executed first.
1083@end deffn
1084
1085@deffn {env} keep @var{pattern}
1086Declares variables matching @var{pattern} (a globbing pattern) as
1087exempt from clearing. This statement implies @code{clear}.
1088
1089For example, the following configuration fragment removes from the
1090environment all variables except @samp{HOME}, @samp{USER},
1091@samp{PATH}, and variables beginning with @samp{LC_}:
1092
1093@example
1094@group
1095env @{
1096 clear yes;
1097 keep HOME;
1098 keep USER;
1099 keep PATH;
1100 keep "LC_*";
1101@}
1102@end group
1103@end example
1104@end deffn
1105
1106@deffn {env} keep "@var{name}=@var{value}"
1107Retains the variable @var{name}, if it has the given value. Note, that
1108the argument must be quoted.
1109@end deffn
1110
1111@deffn {env} set "@var{name}=@var{value}"
1112Assigns @var{value} to environment variable @var{name}. The value is
1113subject to @dfn{variable expansion} using the same syntax as in shell.
1114The @code{set} and @code{unset} (see below) statements are executed in
1115order of their appearance. For example
1116
1117@example
1118@group
1119env @{
1120 set "MYLIB=$HOME/lib";
1121 set "LD_LIBRARY_PATH=$LD_LIBRARY_PATH$@{LD_LIBRARY_PATH:+:@}$MYLIB";
1122@}
1123@end group
1124@end example
1125@end deffn
1126
1127@deffn {env} unset @var{pattern}
1128Unset environment variables matching @var{pattern}. The following
1129will unset the @env{LOGIN} variable:
1130
1131@example
1132unset LOGIN;
1133@end example
1134
1135@noindent
1136The following will unset all variables starting with @samp{LD_}:
1137
1138@example
1139unset "LD_*";
1140@end example
1141
1142@noindent
1143Notice, that patterns containing wildcard characters must be quoted.
1144@end deffn
1145
1146@menu
1147* env legacy syntax::
1148@end menu
1149
1150@node env legacy syntax
1151@subsubsection @code{env}: legacy syntax.
1152Up to version 1.3 @command{pies} implemented the one-line variant of
1153the @code{env} statement. The use of this legacy syntax is
1154discouraged. It is supported for backward compatibility on