Re: [sieve] Variable expansion issues

NED+mta-filters@mauve.mrochek.com Tue, 06 October 2009 16:53 UTC

Return-Path: <NED+mta-filters@mauve.mrochek.com>
X-Original-To: sieve@core3.amsl.com
Delivered-To: sieve@core3.amsl.com
Received: from localhost (localhost [127.0.0.1]) by core3.amsl.com (Postfix) with ESMTP id 1F4FC28C14B for <sieve@core3.amsl.com>; Tue, 6 Oct 2009 09:53:35 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.241
X-Spam-Level:
X-Spam-Status: No, score=-2.241 tagged_above=-999 required=5 tests=[AWL=-0.242, BAYES_00=-2.599, J_CHICKENPOX_45=0.6]
Received: from mail.ietf.org ([64.170.98.32]) by localhost (core3.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h-6arYgaLWso for <sieve@core3.amsl.com>; Tue, 6 Oct 2009 09:53:34 -0700 (PDT)
Received: from mauve.mrochek.com (mauve.mrochek.com [66.59.230.40]) by core3.amsl.com (Postfix) with ESMTP id 23B143A68A8 for <sieve@ietf.org>; Tue, 6 Oct 2009 09:53:34 -0700 (PDT)
Received: from dkim-sign.mauve.mrochek.com by mauve.mrochek.com (PMDF V6.1-1 #35243) id <01NEKCVI3PA800052M@mauve.mrochek.com> for sieve@ietf.org; Tue, 6 Oct 2009 09:55:07 -0700 (PDT)
Received: from mauve.mrochek.com by mauve.mrochek.com (PMDF V6.1-1 #35243) id <01NEJCM72YDC0000BF@mauve.mrochek.com> (original mail from NED@mauve.mrochek.com) for sieve@ietf.org; Tue, 06 Oct 2009 09:55:05 -0700 (PDT)
Date: Tue, 06 Oct 2009 09:03:46 -0700
From: NED+mta-filters@mauve.mrochek.com
In-reply-to: "Your message dated Tue, 06 Oct 2009 17:55:30 +0200" <20091006155529.GB30158@schlund.de>
To: Hannah Schroeter <hannah@schlund.de>
Message-id: <01NEKCVGKSCW0000BF@mauve.mrochek.com>
MIME-version: 1.0
Content-type: TEXT/PLAIN
Content-transfer-encoding: 7bit
References: <20091006155529.GB30158@schlund.de>
Cc: sieve@ietf.org
Subject: Re: [sieve] Variable expansion issues
X-BeenThere: sieve@ietf.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: SIEVE Working Group <sieve.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/listinfo/sieve>, <mailto:sieve-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/sieve>
List-Post: <mailto:sieve@ietf.org>
List-Help: <mailto:sieve-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/sieve>, <mailto:sieve-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Oct 2009 16:53:35 -0000

> Hello!

> I've read the recent mails.

> I agree to the general gist that it's best to specify once and for all
> in the variables extension (RFC 5229) that variables expand in every
> string position unless explicitly specified otherwise and that
> additional ABNF-like language in the other specifications means
> restrictions on the string result *after* variable expansion.

> However, there are a few places where I would like/have liked such an
> explicitly stated restriction on variable expansion.

> The variables extension (RFC 5229) *does* specify such a restriction on
> require (though a bit indirectly: "The require clauses themselves are
> not affected by this extension.", first paragraph in section 1, it'd be
> more explicit if the language using the term "constant string" would've
> been used on "require", too), and on "set" (section 4, "The name MUST be
> a constant string").

I actually disagreed with the exclusion of variables from the first argument to
set here. But that's water long since under the bridge.

> I'd think, then, it'd be logically consequential to require *constant*
> strings in other places where variable *names* are used, such as in
> - Imap4flags (RFC 5232),
>  * The hasflag test (unlike the "string" test it doesn't use
>    interpolation but a variable name itself). I do *not* mean
>    "list-of-flags", but "variable-list".
>  * The setflag, addflag, removeflag actions (section 3.1 through 3.3),
>    parameter "variablename" (I don't mean to talk about
>    "list-of-flags"!). Here, "variablename" is just like "name" in
>    the "set" action in RFC 5229, and "name" for "set" is required to
>    be constant. It'd be non-consequential to allow variable names be
>    given by other variables here, when RFC 5229 just does *not*
>    allow that (indirect variable references).
> - Similarly: draft-ietf-sieve-mime-loop-09.txt,
>  * The "varname" parameter of the "extracttext" action isn't specified
>    to be constant there. The same argument applies though.

Since I disagree with the exclusion of set, I also am opposed to this
expansion. And even if I were to agree to this in principle (which I don't),
I would still object to this change on the grounds that it makes
currently conforming implementation nonconformant for no good reason.

> This especially makes sense as the use of constant strings in "set" and
> not allowing indirect variable references in the interpolation syntax
> allows for statical analysis of how many and which variables are used.
> That is thwarted if one allows other extensions to use variables in
> variable *names*. I think there those changes would be virtually
> necessary.

I understand the logic behind such exclusions. I just don't agree that the
supposed benefits are worth the loss in flexibility.

> The other way of consistency would be to drop the restriction on
> "set" and to allow indirect variable references on interpolation, too,
> e.g. "${x_${bar}}", but then enforcing limits on the number on variables
> used must be deferred to run-time generally.

Doesn't follow. I think exclusion of indirect variable references in
expressions was a good thing, mostly because this is exactly the sort of thing
implementors mess up, but it went too far when it was applied to set, where
it's actually more work to implement the exclusion. However, now that set has
this exclusion, I think more substantial justification is needed to change it
now.

> In fact there are other places where at least *I* would rather like
> *constant* strings (or even tags) to be used, like the match types of
> the relational extension. (And in fact, the ABNF there *did* suggest
> constant strings to me!) IMO, variables don't really buy you much there
> and it just adds unneeded complexity to a Sieve engine that translates
> the script (from a simple enumeration [e.g. C-style enum] of match types
> to a much more complex data type, using a combination of an enumeration
> [basic match types] and a Sieve string, but the latter only sometimes).

While it's true that use cases for variables in relational parameters, or
comparator parameters, seem pretty limited if not entirely nonexistant, in the
absence of a problem this  has caused I don't think a change is justified.

Justification for me for making such a change in whether or not variables are
allowed would be a concrete use case where the change provides a significant
tangible implementation benefit. There may be several cases of this, but the
one I know of is in the body extension. The fact that variables are allowed  in
the search string means that body has to either be implemented using an
unlimited number of passes over the message or by performing extensive
preprocessing of the message (e.g., building a Patricia tree). This limitation
makes body effectively unimplementable in high performance environments. But
take away variable substitutions and you can precompute all the search strings
and implement body in a single pass. This IMO is sufficient justification to at
least consider not allowing variable substitutions in body search strings.

				Ned