diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-06-29 23:28:37 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-06-29 23:28:37 +0300 |
commit | 55130b6b78a343c213147621a6543b0c7a1eb23f (patch) | |
tree | f56770d6ccdadc156bbb528eecf52d1d5f87cbaa | |
parent | 6848736e8458fd95630540d656c104ffc7722144 (diff) | |
download | rush-55130b6b78a343c213147621a6543b0c7a1eb23f.tar.gz rush-55130b6b78a343c213147621a6543b0c7a1eb23f.tar.bz2 |
Issue a notice when parsing a legacy configuration file
* NEWS: Document changes.
* doc/rush.texi: Fix references to the legacy syntax docs.
* src/config.c (cfparse_old): Issue a notice.
* src/rush.c (vlogmsg): Discern between LOG_INFO and LOG_NOTICE.
* tests/legacy/argc.at: Update stderr expectation.
* tests/legacy/backref.at: Likewise.
* tests/legacy/chdir.at: Likewise.
* tests/legacy/command.at: Likewise.
* tests/legacy/delete.at: Likewise.
* tests/legacy/env.at: Likewise.
* tests/legacy/error.at: Likewise.
* tests/legacy/fallthrough.at: Likewise.
* tests/legacy/gid.at: Likewise.
* tests/legacy/interactive.at: Likewise.
* tests/legacy/map.at: Likewise.
* tests/legacy/match.at: Likewise.
* tests/legacy/matchprog.at: Likewise.
* tests/legacy/newgrp.at: Likewise.
* tests/legacy/set.at: Likewise.
* tests/legacy/setvar.at: Likewise.
* tests/legacy/transform.at: Likewise.
* tests/legacy/uid.at: Likewise.
* tests/legacy/umask.at: Likewise.
* tests/legacy/unsetvar.at: Likewise.
-rw-r--r-- | NEWS | 11 | ||||
-rw-r--r-- | doc/rush.texi | 26 | ||||
-rw-r--r-- | src/config.c | 7 | ||||
-rw-r--r-- | src/rush.c | 5 | ||||
-rw-r--r-- | tests/legacy/argc.at | 6 | ||||
-rw-r--r-- | tests/legacy/backref.at | 3 | ||||
-rw-r--r-- | tests/legacy/chdir.at | 3 | ||||
-rw-r--r-- | tests/legacy/command.at | 6 | ||||
-rw-r--r-- | tests/legacy/delete.at | 12 | ||||
-rw-r--r-- | tests/legacy/env.at | 33 | ||||
-rw-r--r-- | tests/legacy/error.at | 12 | ||||
-rw-r--r-- | tests/legacy/fallthrough.at | 6 | ||||
-rw-r--r-- | tests/legacy/gid.at | 6 | ||||
-rw-r--r-- | tests/legacy/interactive.at | 3 | ||||
-rw-r--r-- | tests/legacy/map.at | 4 | ||||
-rw-r--r-- | tests/legacy/match.at | 6 | ||||
-rw-r--r-- | tests/legacy/matchprog.at | 6 | ||||
-rw-r--r-- | tests/legacy/newgrp.at | 3 | ||||
-rw-r--r-- | tests/legacy/set.at | 15 | ||||
-rw-r--r-- | tests/legacy/setvar.at | 3 | ||||
-rw-r--r-- | tests/legacy/transform.at | 15 | ||||
-rw-r--r-- | tests/legacy/uid.at | 6 | ||||
-rw-r--r-- | tests/legacy/umask.at | 3 | ||||
-rw-r--r-- | tests/legacy/unsetvar.at | 3 |
24 files changed, 143 insertions, 60 deletions
@@ -1,9 +1,18 @@ -GNU Rush NEWS -- history of user-visible changes. 2019-05-01 +GNU Rush NEWS -- history of user-visible changes. 2019-06-29 See the end of file for copying conditions. Please send bug reports to <bug-rush@gnu.org.ua> Version 1.9.90 (git) + +This version introduces a completely new syntax for the configuration +file. Please see the documentation for details. + +Old configuration file syntax is still supported, so your existing +installations will remain operational without any changes. +You are however encouraged to switch to the new syntax as soon as +possible. + Version 1.9, 2019-04-24 diff --git a/doc/rush.texi b/doc/rush.texi index 82af391..be4c34e 100644 --- a/doc/rush.texi +++ b/doc/rush.texi @@ -256,6 +256,8 @@ following configuration file rule: @example @group +rush 2.0 + rule sftp # Matching condition match $uid >= 100 && $command ~ "^.*/sftp-server" @@ -267,7 +269,10 @@ rule sftp @end group @end example - The first clause, @code{rule}, defines a new rule. Its argument + The first clause defines the version of the syntax this +configuration uses. Each configuration must begin with this statement. + + Next clause, @code{rule}, defines a new rule. Its argument serves as a rule tag and is used for diagnostic messages and in accounting. @@ -339,9 +344,10 @@ configuration file formats. @cindex syntax, legacy The @dfn{legacy} configuration format is the one used in rush versions up to 1.9. It is still supported to facilitate transition of -existing installations to the new syntax. Its support will be removed -in future versions. The legacy syntax is described in detail in -@uref{http://www.gnu.org.ua/software/rush/manual/1.x}. +existing installations to the new syntax. Its support will eventually +be removed in future versions, so the users are encouraged to switch +to the new syntax as soon as possible. The legacy syntax is described +in detail in @uref{http://www.gnu.org.ua/software/rush/legacy}. This manual describes new configuration file format. @@ -355,7 +361,7 @@ in future versions. The legacy syntax is described in detail in @node Lexical Structure @section Lexical Structure of the Configuration File - Configuration file consist of tokens separated by arbitrary amount + Configuration file consists of tokens separated by arbitrary amount of whitespace characters: horizontal spaces and tabs. Except when enclosed in double quotes or preceded by a dollar sign, the @samp{#} character introduces an inline comment: the character itself and any @@ -515,7 +521,10 @@ rush 2.0 @end example This statement is mandatory. In its absence, the file will be -treated as a legacy configuration file. +treated as a legacy configuration file@footnote{For the discussion of +the legacy syntax, please refer to +@uref{http://www.gnu.org.ua/software/rush/manual/legacy}.}. To avoid +confusion, a notice message to that effect will be printed. Statements that follow form logical groups. Each group begins with a @code{rule} or @code{global} statement. @@ -540,6 +549,7 @@ These statements are described in the sections that follow. ... @end example +@noindent where dots represent any number of statements. The following subsections discuss the statements that can be used within a @code{global} block. @@ -1639,8 +1649,8 @@ keepenv "LC_*" @deffn {rule} setenv @var{name} = @var{value} Set the environment variable @var{name}. The @var{value} -argument is subject to variable expansion (@pxref{Variable -expansion}) and backreference interpretation (@pxref{{backreference}). +argument is subject to variable expansion (@pxref{Variable expansion}) +and backreference interpretation (@pxref{backreference}). For example, to modify the @env{PATH} value: diff --git a/src/config.c b/src/config.c index 07a3731..752e692 100644 --- a/src/config.c +++ b/src/config.c @@ -1362,6 +1362,13 @@ cfparse_old(CFSTREAM *cf, char const *filename, int line) { input_buf_ptr buf; + if (strcmp (filename, "<built-in>") == 0) { + logmsg(LOG_NOTICE, _("parsing legacy built-in configuration")); + } else { + logmsg(LOG_NOTICE, _("parsing legacy configuration file %s"), + filename); + } + init_input_buf(&buf, NULL, cf, filename, line - 1); return parse_input_buf(buf); } @@ -173,10 +173,13 @@ vlogmsg(int prio, const char *fmt, va_list ap) break; case LOG_INFO: - case LOG_NOTICE: fprintf(stderr, _("Info: ")); break; + case LOG_NOTICE: + fprintf(stderr, _("Notice: ")); + break; + case LOG_WARNING: fprintf(stderr, _("Warning: ")); break; diff --git a/tests/legacy/argc.at b/tests/legacy/argc.at index f401cd0..ff02e67 100644 --- a/tests/legacy/argc.at +++ b/tests/legacy/argc.at @@ -37,12 +37,14 @@ rule "acct":-1 } ], -[], +[rush: Notice: parsing legacy configuration file test.conf +], [/usr/bin/echo foo bar], [1], [], -[rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER ]) AT_CLEANUP diff --git a/tests/legacy/backref.at b/tests/legacy/backref.at index 23dfbd2..6428b68 100644 --- a/tests/legacy/backref.at +++ b/tests/legacy/backref.at @@ -36,7 +36,8 @@ rule runcom "home_dir":"$TESTDIR" } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/chdir.at b/tests/legacy/chdir.at index d1c45ee..b5ff5e1 100644 --- a/tests/legacy/chdir.at +++ b/tests/legacy/chdir.at @@ -28,7 +28,8 @@ rule "home_dir":"$TESTDIR" } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/command.at b/tests/legacy/command.at index 1425025..82f15c8 100644 --- a/tests/legacy/command.at +++ b/tests/legacy/command.at @@ -37,12 +37,14 @@ rule "acct":-1 } ], -[], +[rush: Notice: parsing legacy configuration file test.conf +], [/usr/bin/echo foo bar], [1], [], -[rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "/usr/bin/echo foo bar", user $MY_USER ]) AT_CLEANUP diff --git a/tests/legacy/delete.at b/tests/legacy/delete.at index 5beab6e..468fad7 100644 --- a/tests/legacy/delete.at +++ b/tests/legacy/delete.at @@ -33,7 +33,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -51,7 +52,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -70,7 +72,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -80,7 +83,8 @@ rule [echo foo bar], [1], [], -[rush: Error: Deleting argv[[0]] is prohibited +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: Deleting argv[[0]] is prohibited ]) AT_CLEANUP diff --git a/tests/legacy/env.at b/tests/legacy/env.at index 9457988..9b91ee4 100644 --- a/tests/legacy/env.at +++ b/tests/legacy/env.at @@ -28,7 +28,8 @@ rule "environ":[[]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER LOGIN=$MY_USER]) AT_RUSH_TEST([ @@ -45,7 +46,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -61,7 +63,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER LOGIN=NO_$MY_USER]) @@ -80,7 +83,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER LOGIN=NO_$MY_USER PATH=$PATH]) @@ -98,7 +102,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i HOME=$PWD USER=$MY_USER]) @@ -117,7 +122,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i]) @@ -134,7 +140,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i MYPATH=/bin:/usr/bin]) @@ -151,7 +158,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i]) @@ -168,7 +176,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i MYPATH=/bin:/usr/bin]) @@ -185,7 +194,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) m4_pushdef([RUSH_ENVIRON],[-i MYPATH=/bin:/usr/bin]) @@ -202,7 +212,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) m4_popdef([RUSH_ENVIRON]) AT_CLEANUP diff --git a/tests/legacy/error.at b/tests/legacy/error.at index c0094ce..7100bef 100644 --- a/tests/legacy/error.at +++ b/tests/legacy/error.at @@ -25,7 +25,8 @@ rule [command], [1], [], -["Forced error" +[rush: Notice: parsing legacy configuration file test.conf +"Forced error" ]) AT_RUSH_TEST([ @@ -37,7 +38,8 @@ rule [1], ["Forced error" ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -49,7 +51,8 @@ rule [You do not have interactive login access to this machine. Contact the systems administrator for further assistance. ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -60,6 +63,7 @@ rule [1], [@nologin-error ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/fallthrough.at b/tests/legacy/fallthrough.at index e285027..1472705 100644 --- a/tests/legacy/fallthrough.at +++ b/tests/legacy/fallthrough.at @@ -36,7 +36,8 @@ rule ]] } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -56,7 +57,8 @@ rule "home_dir":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/gid.at b/tests/legacy/gid.at index 3d880ba..87df791 100644 --- a/tests/legacy/gid.at +++ b/tests/legacy/gid.at @@ -33,7 +33,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -43,7 +44,8 @@ rule [ls /], [1], [], -[rush: Error: no matching rule for "ls /", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "ls /", user $MY_USER ]) AT_CLEANUP diff --git a/tests/legacy/interactive.at b/tests/legacy/interactive.at index 396b7d3..234bfe1 100644 --- a/tests/legacy/interactive.at +++ b/tests/legacy/interactive.at @@ -33,7 +33,8 @@ rule "interactive":1 } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/map.at b/tests/legacy/map.at index 8077d9c..a020ad1 100644 --- a/tests/legacy/map.at +++ b/tests/legacy/map.at @@ -74,6 +74,10 @@ No match, no default ]], "prog":null } +], +[rush: Notice: parsing legacy configuration file test.conf +rush: Notice: parsing legacy configuration file test.conf +rush: Notice: parsing legacy configuration file test.conf ]) AT_CLEANUP diff --git a/tests/legacy/match.at b/tests/legacy/match.at index a68f133..15585df 100644 --- a/tests/legacy/match.at +++ b/tests/legacy/match.at @@ -34,12 +34,14 @@ rule "prog":null } ], -[], +[rush: Notice: parsing legacy configuration file test.conf +], [/usr/bin/echo bar], [1], [], -[rush: Error: no matching rule for "/usr/bin/echo bar", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "/usr/bin/echo bar", user $MY_USER ]) AT_CLEANUP diff --git a/tests/legacy/matchprog.at b/tests/legacy/matchprog.at index 4b6dec2..37161c8 100644 --- a/tests/legacy/matchprog.at +++ b/tests/legacy/matchprog.at @@ -34,12 +34,14 @@ rule "prog":null } ], -[], +[rush: Notice: parsing legacy configuration file test.conf +], [echo foo], [1], [], -[rush: Error: no matching rule for "echo foo", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "echo foo", user $MY_USER ]) diff --git a/tests/legacy/newgrp.at b/tests/legacy/newgrp.at index df3fbcd..090f27e 100644 --- a/tests/legacy/newgrp.at +++ b/tests/legacy/newgrp.at @@ -28,7 +28,8 @@ rule "gid":0 } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/set.at b/tests/legacy/set.at index 347ead6..f52abf3 100644 --- a/tests/legacy/set.at +++ b/tests/legacy/set.at @@ -33,7 +33,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -51,7 +52,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -69,7 +71,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -87,7 +90,8 @@ rule "prog":"/usr/bin/ls" } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -105,7 +109,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/setvar.at b/tests/legacy/setvar.at index be580c8..fc008fe 100644 --- a/tests/legacy/setvar.at +++ b/tests/legacy/setvar.at @@ -39,5 +39,6 @@ rule last } } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/transform.at b/tests/legacy/transform.at index 97766e7..fbe2a3b 100644 --- a/tests/legacy/transform.at +++ b/tests/legacy/transform.at @@ -33,7 +33,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -53,7 +54,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -71,7 +73,8 @@ rule "prog":null } ], -[], +[rush: Notice: parsing legacy configuration file test.conf +], [/bin/echo foo], [0], @@ -84,7 +87,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -101,6 +105,7 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/uid.at b/tests/legacy/uid.at index 29edfe0..14c6919 100644 --- a/tests/legacy/uid.at +++ b/tests/legacy/uid.at @@ -33,7 +33,8 @@ rule "prog":null } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_RUSH_TEST([ rule @@ -43,7 +44,8 @@ rule [ls /], [1], [], -[rush: Error: no matching rule for "ls /", user $MY_USER +[rush: Notice: parsing legacy configuration file test.conf +rush: Error: no matching rule for "ls /", user $MY_USER ]) AT_CLEANUP diff --git a/tests/legacy/umask.at b/tests/legacy/umask.at index f4eee7b..7fbcd0a 100644 --- a/tests/legacy/umask.at +++ b/tests/legacy/umask.at @@ -28,7 +28,8 @@ rule "umask":017 } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP diff --git a/tests/legacy/unsetvar.at b/tests/legacy/unsetvar.at index 37f378e..191db79 100644 --- a/tests/legacy/unsetvar.at +++ b/tests/legacy/unsetvar.at @@ -42,5 +42,6 @@ rule last } } ], -[]) +[rush: Notice: parsing legacy configuration file test.conf +]) AT_CLEANUP |