Re: [Cbor] CDDL spec should specify how CBOR items match types

Jeffrey Yasskin <jyasskin@chromium.org> Sun, 09 July 2017 14:45 UTC

Return-Path: <jyasskin@google.com>
X-Original-To: cbor@ietfa.amsl.com
Delivered-To: cbor@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 878E11293E1 for <cbor@ietfa.amsl.com>; Sun, 9 Jul 2017 07:45:21 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.com header.b=OC2cGOFC; dkim=pass (1024-bit key) header.d=chromium.org header.b=l+6tfrRJ
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y8z7lSR1Kv00 for <cbor@ietfa.amsl.com>; Sun, 9 Jul 2017 07:45:19 -0700 (PDT)
Received: from mail-wr0-x22d.google.com (mail-wr0-x22d.google.com [IPv6:2a00:1450:400c:c0c::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 83E0C128990 for <cbor@ietf.org>; Sun, 9 Jul 2017 07:45:19 -0700 (PDT)
Received: by mail-wr0-x22d.google.com with SMTP id c11so106299467wrc.3 for <cbor@ietf.org>; Sun, 09 Jul 2017 07:45:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=rMpF6hkSQLQUzYjzdVf9Ra0DKEl3RBQ96vjOXCAwnJg=; b=OC2cGOFCVFQzd2/d1yzCCDe4VQ7a/X54Vshr+2M+3oQhztOQ80alYehLvOfxKuONt6 ALBNKNSlHzvZ92ypr4hs3IpG27GgZ1lDyRj4Ju9Pb3wB/SGm28/gL9Z4h+9C/yzMjv+y EU8aLk/drE58fkHhJ6Bcsu4iwxw/gUjor23BORrvoB7ujlJ0TuWLQb2Ji0A/KupeD7EW BBvpcuVycHJnzYG1s0eEyQlc5BxMGGV4CxtjbMwEyqACybrK+tNAU8XegIV9oJ9rRB6i BkfbEBEc1neefMLO0lx9VB+u2PEuQm5rmqYAKB9yQytZi+Tk6AduM2to/Z+yEMuvZk6w PayA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=rMpF6hkSQLQUzYjzdVf9Ra0DKEl3RBQ96vjOXCAwnJg=; b=l+6tfrRJE1W9/qWv2T9ZxHhwyJh0luPFjM3LdaRh3+GMWRo4n4zlZDSqWmhfEXMNNd 0l9P8M90qRHK5F8Qugy5RIZ7cD5bSaQ/RPleiQi2nQPwWIEIF3FWii+aUowepjCZhqcB hw1sB7kRmP/amXFW/Qe7Ut2MPidhpZRYUZKL8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=rMpF6hkSQLQUzYjzdVf9Ra0DKEl3RBQ96vjOXCAwnJg=; b=iElng9/zXyM4KqDyx/EQEzVxf9ZO5I3vm4AYl7UKWMi0i/QDhTGkXXdB08c/0Bw301 NrLkVR1Bghf/TztrzS/yQ2BoBhIbQEhpgxz3tBabwacI38C7KJU5qMC+PaDQqcSP0YtY 7jQkJRsOpc4KbG7geeI+HOeQ3YbQMIA6Xx9+hDAbq3jU3IHW0Ac50rDDR8iTyvM+t+MO LGPqckHJGJvTDaaDTI85DAhFQDwIHggjHZ2Xe5IlvE7EaA7NTC7y89kvOi6bjimpbwnR w5sy7x3SQXD4JlAImKJcKZwn0vnZpi92AzG8JBeEK0Mgk6/XWSy4bTUw+io3aHK+kUcF VA1w==
X-Gm-Message-State: AIVw113mPzXPr8prXrdnqjfg2Uc8Wnx/OWfl0zZOqgSX3NgJGfdJnJDV RUFvnCfN29oOG1X4RulcE5lUDvKs/Y9NNbKW2w==
X-Received: by 10.223.183.40 with SMTP id l40mr5647314wre.154.1499611517857; Sun, 09 Jul 2017 07:45:17 -0700 (PDT)
MIME-Version: 1.0
Sender: jyasskin@google.com
Received: by 10.28.97.6 with HTTP; Sun, 9 Jul 2017 07:44:57 -0700 (PDT)
In-Reply-To: <E8755B87-28CF-4208-8293-5902AA8BA3DC@tzi.org>
References: <CANh-dXm=Ks-iSHnwz=hZ8_7qshQxmynLQ7jFwcrbs+vP=cHZuQ@mail.gmail.com> <E8755B87-28CF-4208-8293-5902AA8BA3DC@tzi.org>
From: Jeffrey Yasskin <jyasskin@chromium.org>
Date: Sun, 09 Jul 2017 07:44:57 -0700
X-Google-Sender-Auth: iIJAO_xzAG7wcXLfSzMtFQPUHkg
Message-ID: <CANh-dXmah7vp4vo7_wWid7PGSD00m6hJqHsoLQB6mhWHkFck_Q@mail.gmail.com>
To: Carsten Bormann <cabo@tzi.org>
Cc: Jeffrey Yasskin <jyasskin@chromium.org>, cbor@ietf.org
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/oCQe5S1qJif6nAU49MbZrTkRctE>
Subject: Re: [Cbor] CDDL spec should specify how CBOR items match types
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "Concise Binary Object Representation \(CBOR\)" <cbor.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/cbor>, <mailto:cbor-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cbor/>
List-Post: <mailto:cbor@ietf.org>
List-Help: <mailto:cbor-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/cbor>, <mailto:cbor-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sun, 09 Jul 2017 14:45:21 -0000

I just noticed that the current draft is informational, so it can't be
used the way ABNF is used, to help with writing other standards, as
much as I'd like to. For informational documents, I agree that "pretty
clear" is enough, but I hope we can aim for a standard instead.

Jeffrey

On Thu, Jul 6, 2017 at 11:44 PM, Carsten Bormann <cabo@tzi.org> wrote:
> Hi Jeffrey,
>
> Yes, we have to replace “self-evident” etc. by actually explaining things.
>
> However, I’m pretty sure we are on the safe side with the # constructs, as well as with [] and {}.
> These may not be explained in so many words, but it is still pretty clear what they mean.
>
> We have more of an undefined state with literals such as 10, 10.0, 1e1, and with applying range operators, in particular if they span CBOR major types (-5..10 is pretty clear, but what does 1..10.0 mean?).  When applied to floating point, the range operator also does not say what precision is needed (you can help yourself with construct such as `-10.0..10.0 .and float16`, but that is neither supported by the tool nor explained at all).
>
> I would like to keep CDDL operating at the data model level, even with its history of toying with anchoring it at the serialization level.  Yes, the # construct is in serialization terms, but this is just a shortcut to have a single construct cover all of CBOR (well, you have to add {} and [], because these need groups).
>
> There are a few more areas that are not fully defined, e.g., which exact PCRE variant exactly does .regexp use.
> I would be inclined in *not* overspecifying this at this point.  (And we haven’t solved the “line too long” problem there; see prelude for tdate which is not using a regexp even though it could — try a `cddl -<<<x=tdate generate` for fun.)
>
> So, lots of editorial work remaining indeed, but the technical discussion probably should focus on the numeric system underlying CDDL.
>
> Grüße, Carsten
>
>
>> On Jul 7, 2017, at 01:01, Jeffrey Yasskin <jyasskin@chromium.org> wrote:
>>
>> Apologies if I'm just reading
>> https://tools.ietf.org/html/draft-greevenbosch-appsawg-cbor-cddl-11
>> badly, but I don't see a specification of which CBOR items match which
>> types.
>>
>> Sections like https://tools.ietf.org/html/draft-greevenbosch-appsawg-cbor-cddl-11#section-3.4
>> (Arrays) specify how to write an array type, but I don't see a
>> normative statement that '82 01 02' is an instance of [*uint] or that
>> '01' and '42 01 02' aren't.
>>
>> I also don't see a definition of '#' in order to ground the meaning of
>> the prelude. "How this is used should be evident from the prelude
>> (Appendix E)." from 2.2.3. Representation Types isn't really
>> sufficient to specify it.
>>
>> I think this lack of specification is at the root of Kevin Braun's set
>> of bugs in https://mailarchive.ietf.org/arch/msg/cbor/Z1XcZSTLbTDnqA9HP8UXjeUOspE.
>>
>> I'd be inclined to fix this by specifying each CDDL type as a
>> recursive parser, which accepts or rejects either CBOR items or byte
>> strings. I think the choice of item vs bytes comes down to where we
>> want to put the serialization constraints (like
>> "indefinite-containers") described in
>> https://mailarchive.ietf.org/arch/msg/cbor/Pv191TJRBiG1QOJbJL8iVHjUDuE,
>> but it could also have some implications for how parsers return data
>> from unfinished byte streams.
>>
>> Jeffrey
>>
>> _______________________________________________
>> CBOR mailing list
>> CBOR@ietf.org
>> https://www.ietf.org/mailman/listinfo/cbor
>>
>