Each individual rule (
command) in the configuration file
can be thought of as a while-do statement.
Recall that rules are composed of an
(right-hand side), separated from each other by tabs.
As long as (while) the
matches the workspace, the workspace is rewritten (do) by
Consider a rule in which we want the
in the workspace changed into the name
One possible rule to do this might look like this:
If the workspace contains the name
rule matches exactly. As a consequence, the
the opportunity to rewrite the workspace. It does so by placing
into that workspace. The new workspace is once
again compared to the
, but now
there is no match because the workspace contains
the workspace and the
do not match, the rule is skipped,
of the workspace are carried down
to the next rule. Thus, in our example, the name
in the workspace is carried down.
Clearly, there is little reason to worry about endless loops in a rule
when using names like
. But the
can contain pattern-matching and replacement
operators, and those operators
lead to loops.
To illustrate, consider this example from the
will always match
both before and
after each rewrite. Here's what happens in testing this rule in
/usr/lib/sendmail -bt -Cx.cf
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
rewrite: ruleset 0 input: fred
Infinite loop in ruleset 0, rule 1
rewrite: ruleset 0 returns: fred
discovers the loop and breaks it for you. Earlier versions
would hang forever.