ietf-mta-filters
[Top] [All Lists]

Editheader issues

2007-04-24 14:51:32

We jyst had an interesting bug filed on our editheader implementation. The
header in question contained:

 X-Test: instance 1
 X-Test: instance 2
 X-Test: instance 3
 X-Test: instance 4
 X-Test: instance 5
 X-Test: instance 6

And here's the sieve script:

 require "editheader";
 deleteheader :index 1 "X-Test";
 deleteheader :index 2 "X-Test";
 deleteheader :index 3 "X-Test";
 deleteheader :index 4 "X-Test";
 deleteheader :index 5 "X-Test";
 deleteheader :index 6 "X-Test";

They expected the resulting header not to contain any X-Test fields. What they
ended up with was:

 X-Test: instance 2
 X-Test: instance 4
 X-Test: instance 6

The issue, of course, is whether deleteheader acts immediately and removes the
headser in question, renumbering the remaining fields with the same label, or
whether it removes the field but keeps the numbering. The draft isn't specific
about the interaction of deleteheader with itself, however, it does say that
any edits you make are immediately visible to subsequent header and address
tests.

I think the only sensible thing is for deleteheader to act immediately and
renumber. Having some things consider the original header and others consider
the modified one would be terribly confusing. (The example shown above might
actually be a good one to include in the draft to show how this is supposed to
work.)
We also need to specify how addheader interacts with deleteheader. The
following should be essentially a no-op IMO:

  require "editheader";
  addheader "X-test" "whatever";
  deleteheader :index 1 "X-Test"

A couple of other issues occured to me while looking at this general area. 
First, we need to
specify what happens if the comparator or match-type arguments are present in
deleteheader but no value-pattern(s) is(are) specified. I suggest saying that
the comparator and match-type are ignored in this case.

We also need to specify what happens if :last is specified in deleteheader
without :index. I suggest saying that it will be ignored. The alternative is
for it to assume an index of 1, but clarity should trump having a more concise
way of specifying "delete the last field"

                                Ned

<Prev in Thread] Current Thread [Next in Thread>