GNU Rush – a restricted user shell (split by chapter):   Section:   Chapter:FastBack: Usage Tips   Up: Top   FastForward: Option Summary   Contents: Table of ContentsIndex: Concept Index

7 Test Mode

GNU Rush provides a special test mode, intended to test configuration files and to emulate execution of commands. The test mode is enabled by --test command line option (aliases: --lint, -t). When rush is given this option, the following occurs:

  1. All diagnostic messages are redirected to standard error, instead of syslog.
  2. If a single non-option argument is present, it is taken as a name of the configuration file to use.
  3. The configuration file is parsed. If parsing fails, the program exits with the code 1.
  4. If the -c option is present, rush processes its argument as usual (see Operation), except that the command itself is not executed.
  5. Otherwise, if -i option is present, rush emulates interactive usage, but does not execute the final command.

An exit status of 0 means no errors, 1 means an error has occurred.

You may also emulate access by a particular user, by supplying his user name via the --user (-u) option. This option implies --test.

In test mode, you may set debugging level (see Debugging) from the command line, using the --debug (-d) command line option. It expects a single number specifying debugging level as its argument. The debugging level set this way overrides settings from the configuration file.

Following are several examples that illustrate the use of test mode in various cases:

  1. Test default configuration file:
    $ rush --test
  2. Test configuration file sample.rc:
    $ rush --test sample.rc
  3. Test interactive access
    $ rush --test -i sample.rc
  4. Test the configuration file and emulate execution of the command cvs server. Use debugging level 2:
    $ rush --test --debug=2 -c "cvs server"
  5. Same, but for user ‘jeff’:
    $ rush --user=jeff --debug=2 -c "cvs server"

    Note, that you don’t need to specify --test along with --user or -i options.

  6. Same, but use sample.rc instead of the default configuration file:
    $ rush --test --debug=2 -c "cvs server" sample.rc

7.1 Dump Mode

Dump mode is similar to test mode. The main difference is that in this mode, rush dumps on the standard error a description of the user request after performing all checks and transformations.

The mode is requested by the --dump=attr (-D attr) option. The argument attr is a comma-separated list of the names of attributes to be included in the dump, or the word ‘all’, standing for all attributes.

Additional options and arguments are the same as for the --test option.

The description is formatted as a JSON object8 with the following attributes. These are also the allowed values for the attr list:


Command line after transformations.


Array of command line arguments after transformations.


Name of the program to be executed. If ‘null’, argv[0] will be used.


0’ for normal requests, ‘1’ for interactive requests.


Name of the user from the system user database.


UID of the user.


GID of the user.


Home directory of the user, as set in the system user database.


Value of the umask (octal).


Chroot directory.


Current working directory.


New GID as set by the newgrp action, or ‘-1’ if unchanged.


Fork mode. It is a three-state attribute: ‘0’ meaning disabled, ‘1’ meaning enabled, and ‘-1’ meaning default state.


Accounting mode. See ‘fork’, for a description of possible values.


Textual domain for i18n.


Locale directory for i18n.


Locale name


Dump of the environment (array of assignments).

The attribute ‘all’ stands for all attribute in the same order as listed in the table above.



Well, almost. It diverges from the JSON standard in that slash characters are not escaped in string objects.

GNU Rush – a restricted user shell (split by chapter):   Section:   Chapter:FastBack: Test Mode   Up: Test Mode   FastForward: Option Summary   Contents: Table of ContentsIndex: Concept Index