Copyright (c) 2003, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
The bart_rules file is a text file that is used by the bart(8) command. The rules file determines which files to validate and which file attributes of those files to ignore.
Some lines are ignored by the manifest comparison tool. Ignored lines include blank lines, lines that consist only of white space, and comments that begin with #.
The rules file supports three directives: CHECK, IGNORE, and a subtree directive, which is an absolute path name and optional pattern matching modifiers. Each CHECK, IGNORE, and subtree directive must be on a separate line. Bart supports continuation of long lines using a backslash (\e). The rules file uses the directives to create logical blocks.
The syntax for the rules file is as follows:
[IGNORE attribute...]* [CHECK] [attribute...]* subtree1 [pattern...]* [IGNORE attribute...]* [CHECK] [attribute...]* subtree2 [pattern...]* subtree3 [pattern...]* subtree4 [pattern...]* [IGNORE attribute...]* [CHECK] [attribute...]* ...
Rule blocks are composed of statements that are created by using directives and arguments.
There are three types of blocks: Global Block
The first block in the file. The block is considered ``global'' if it specifies CHECK and IGNORE statements, but no previous subtree statement. A global block pertains to all subsequent blocks.
A block that specifies CHECK and IGNORE statements as well as a subtree directive. The rules in this block pertain to files and directories found in the specified subtree.
A block that contains a null CHECK statement, no arguments. This block inherits the global CHECK statements and IGNORE statements.
The order in which CHECK and IGNORE statements appear in blocks is important. The bart command processes CHECK and IGNORE statements in the order in which they are read, with later statements overriding earlier statements.
Subtree specifications must appear one per line. Each specification must begin with an absolute path name. Optionally, each specification can be followed by pattern-matching arguments.
When a file system being tracked belongs to more than one subtree directive, bart performs the following resolution steps:
Applies the CHECK and IGNORE statements set in the global block. Note that all CHECK and IGNORE statements are processed in order.
Finds the last subtree directive that matches the file.
Processes the CHECK and IGNORE statements that belong to the last matching subtree directive. These statements are processed in the order in which they are read, overriding global settings.
There are two types of pattern matching statements AND
For a given subtree directive, all pattern matching statements are logically ANDed with the subtree. Patterns have the following syntax:
Wildcards are permitted for both the subtree and pattern matching statements.
The exclamation point (!) character represents logical NOT.
A pattern that terminates with a slash is a subtree. The absence of a slash indicates that the pattern is not a directory. The subtree itself does not require an end slash.
/home/nickiso/src !*.o !core !SCCS/ CHECK all
Group multiple subtree directives together. Such subtree directives are logically ORed together.
/home/nickiso/src !*.o !core /home/nickiso/Mail /home/nickiso/docs *.sdw CHECK all IGNORE mtime lnmtime dirmtimeThe files included in the previous example are as follows: For these files, all attributes are checked except for modification times.
The bart command uses CHECK and IGNORE statements to define which attributes to track or ignore. Each attribute has an associated keyword.
The attribute keywords are as follows: acl
ACL attributes for the file. For a file with ACL attributes, this field contains the output from acltotext().
All attributes.
Checksum value of the file. This attribute is only specified for regular files. If you turn off context checking or if checksums cannot be computed, the value of this field is -.
Destination of a symbolic link.
Value of the device node. This attribute is for character device files and block device files only.
Modification time in seconds since 00:00:00 UTC, January 1, 1970 for directories.
Numerical group ID of the owner of this entry.
Creation time for links.
Octal number that represents the permissions of the file.
Modification time in seconds since 00:00:00 UTC, January 1, 1970 for files.
File size in bytes.
Type of file.
Numerical user ID of the owner of this entry.
Example 1 Sample Rules File
The following is a sample rules file:
# Global rules, track everything except dirmtime. CHECK all IGNORE dirmtime # The files in /data* are expected to change, so don't bother # tracking the attributes expected to change. # Furthermore, by specifying ``IGNORE contents,'' you save # time and resources. /data* IGNORE contents mtime size /home/nickiso f* bar/ IGNORE acl # For /usr, apply the global rules. /usr CHECK # Note: Since /usr/tmp follows the /usr block, the /usr/tmp # subtree is subjected to the ``IGNORE all.'' /usr/tmp /home/nickiso *.o /home/nickiso core /home/nickiso/proto IGNORE all
The following files are cataloged based on the sample rules file:
All attributes, except for dirmtime, mtime, size, and contents, are tracked for files under the /data* subtrees.
All .o and core files under /home/nickiso, as well as the /home/nickiso/proto and /usr/tmp subtrees, are ignored.
bart_manifest (5), attributes (7), bart (8)