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

Carsten Bormann <cabo@tzi.org> Fri, 07 July 2017 06:44 UTC

Return-Path: <cabo@tzi.org>
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 068D612F257 for <cbor@ietfa.amsl.com>; Thu, 6 Jul 2017 23:44:17 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.199
X-Spam-Level:
X-Spam-Status: No, score=-4.199 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
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 iRAlbcCiUSfx for <cbor@ietfa.amsl.com>; Thu, 6 Jul 2017 23:44:15 -0700 (PDT)
Received: from mailhost.informatik.uni-bremen.de (mailhost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id EE1C0128B8F for <cbor@ietf.org>; Thu, 6 Jul 2017 23:44:14 -0700 (PDT)
X-Virus-Scanned: amavisd-new at informatik.uni-bremen.de
Received: from submithost.informatik.uni-bremen.de (submithost.informatik.uni-bremen.de [IPv6:2001:638:708:30c9::b]) by mailhost.informatik.uni-bremen.de (8.14.5/8.14.5) with ESMTP id v676iB8o018681; Fri, 7 Jul 2017 08:44:11 +0200 (CEST)
Received: from [192.168.217.124] (p5DC7E215.dip0.t-ipconnect.de [93.199.226.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by submithost.informatik.uni-bremen.de (Postfix) with ESMTPSA id 3x3lSq0nMdz3ZF6; Fri, 7 Jul 2017 08:44:11 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <CANh-dXm=Ks-iSHnwz=hZ8_7qshQxmynLQ7jFwcrbs+vP=cHZuQ@mail.gmail.com>
Date: Fri, 07 Jul 2017 08:44:10 +0200
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 521102650.332144-d7e10745bf9e8fde2f9e0593a09df220
Content-Transfer-Encoding: quoted-printable
Message-Id: <E8755B87-28CF-4208-8293-5902AA8BA3DC@tzi.org>
References: <CANh-dXm=Ks-iSHnwz=hZ8_7qshQxmynLQ7jFwcrbs+vP=cHZuQ@mail.gmail.com>
To: Jeffrey Yasskin <jyasskin@chromium.org>
X-Mailer: Apple Mail (2.3273)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/diQisQjPQGFgUvtu0gRLAXue8fw>
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: Fri, 07 Jul 2017 06:44:17 -0000

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
>