Re: [sieve] I-D Action: draft-ietf-sieve-convert-02.txt

Barry Leiba <barryleiba@computer.org> Fri, 12 August 2011 14:13 UTC

Return-Path: <barryleiba.mailing.lists@gmail.com>
X-Original-To: sieve@ietfa.amsl.com
Delivered-To: sieve@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 6888D21F888A for <sieve@ietfa.amsl.com>; Fri, 12 Aug 2011 07:13:27 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.888
X-Spam-Level:
X-Spam-Status: No, score=-102.888 tagged_above=-999 required=5 tests=[AWL=0.089, BAYES_00=-2.599, FM_FORGED_GMAIL=0.622, RCVD_IN_DNSWL_LOW=-1, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 67PwIjSiZt0I for <sieve@ietfa.amsl.com>; Fri, 12 Aug 2011 07:13:26 -0700 (PDT)
Received: from mail-gw0-f44.google.com (mail-gw0-f44.google.com [74.125.83.44]) by ietfa.amsl.com (Postfix) with ESMTP id B76FF21F85A1 for <sieve@ietf.org>; Fri, 12 Aug 2011 07:13:26 -0700 (PDT)
Received: by gwb20 with SMTP id 20so2316542gwb.31 for <sieve@ietf.org>; Fri, 12 Aug 2011 07:14:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=R3tAHX76kLDMVkyPJhB7obPkYNtJMS/6frKR7c2rm08=; b=ueAXmjnOXmk7ImrTyJGsnWbDKeux3kQS/bsICtUyEvVYjY5Yg8Vz2sn6qHPBOYLlUS 26xFj1WtRZRan4PRUgDcQlLso6cU1+ajQi+95PYtrePAkT+b/NYcqo4UXIkjyF+CUoWa nhSVcYWAcHv4RyduwaqvV6I8IJVjtBeNPd058=
MIME-Version: 1.0
Received: by 10.236.144.232 with SMTP id n68mr3049061yhj.177.1313158443784; Fri, 12 Aug 2011 07:14:03 -0700 (PDT)
Sender: barryleiba.mailing.lists@gmail.com
Received: by 10.147.181.13 with HTTP; Fri, 12 Aug 2011 07:14:03 -0700 (PDT)
In-Reply-To: <4E408AA5.2060106@rename-it.nl>
References: <20110725181813.15532.90958.idtracker@ietfa.amsl.com> <4E30197D.4060803@rename-it.nl> <4E3AB627.1060005@isode.com> <4E408AA5.2060106@rename-it.nl>
Date: Fri, 12 Aug 2011 10:14:03 -0400
X-Google-Sender-Auth: rXFJoecndmgcQkSqsOcgUO0Wi28
Message-ID: <CAC4RtVANdzs-i8OHhfzH=QCXyh2m-bmNqy_zK+pzQ0VnO8ovkQ@mail.gmail.com>
From: Barry Leiba <barryleiba@computer.org>
To: Stephan Bosch <stephan@rename-it.nl>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Cc: sieve@ietf.org
Subject: Re: [sieve] I-D Action: draft-ietf-sieve-convert-02.txt
X-BeenThere: sieve@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: SIEVE Working Group <sieve.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/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: Fri, 12 Aug 2011 14:13:27 -0000

First, as I said on the mic in Québec, thanks, Stephan, for great
reviews of convert and imap-sieve.  I'll be getting to the latter
soon.

Stephan has brought up two main issues (the third is easy, and I've
clarified that for the upcoming version):

1. Do we need a test for what conversions are supported?

2. How do we handle error conditions?

I've tentatively made the following change to section 2 for the second item:

OLD
   Implementations ought to defer any actual conversion until the final
   resolution of other actions, to avoid doing conversions unnecessarily
   in cases where the message is not retained (such as where the
   resolution is "discard").

NEW
   If a "convert" action cannot be completed -- perhaps because the
   conversion failed, or because the requested conversion is not
   available -- the message MUST remain unchanged, and the script
   processing continues.  In particular, no error condition is raised,
   and no partial conversions are allowed.

   Implementations might defer any actual conversion until the the
   results of the conversion are needed for script processing, to avoid
   doing conversions unnecessarily.  Consider the case wherein a
   "convert" action is processed, but a "discard" action results without
   the need to actually perform the conversion.


Now, this doesn't take into account Alexey's comment that he'd like to
see a runtime error when conversion fails, so I want to push on this:
What is the use case?  Is it more valuable to the use case for a
failed conversion to crash the script, or for it to just continue?
The sense I have is that it should continue (which is why I wrote the
text above).

If we go with my version, there's an issue of what happens when we're
converting the whole message ("convert" outside a MIME loop) and, say,
three body parts convert OK and one doesn't.  Do we consider that a
"partial conversion", and roll back the conversion on the three
successful ones?  Or do we only worry about making sure the part that
failed is back to its previous state?

Finally, I had an idea for how we could do the testing, which might
satisfy both issues:
Why not have the "convert" action *also* be a test.  Like this:

*** convert with no test ***
       require ["mime", "fileinto", "convert"];
       if header :mime :anychild :contenttype
                 "Content-Type" "image/tiff"
       {
         convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240";
         fileinto "INBOX.pics";
       }


*** convert with test ***
       require ["mime", "fileinto", "convert"];
       if header :mime :anychild :contenttype
                 "Content-Type" "image/tiff"
       {
         if convert "image/tiff" "image/jpeg" "pix-x" "320" "pix-y" "240"
         {
           fileinto "INBOX.pics";
         }
       }


So it could work either way.  In the case where it's used in a test,
it would evaluate TRUE if it ran with no errors -- that is, the
conversion is supported, the parameters are correct, and no
conversions failed (Q: is it also TRUE if no conversions needed to be
done, or is it only TRUE if at least one conversion was done?).  If
it's used only as an action, with no test, then any failure generates
a runtime error.

What do people think about that?  This would be the first action that
could also be used as a test, so think about whether that's good for
the language.  I like it, and I think it makes things very simple.

Barry