Re: [Cbor] Invalid decimal fraction / big float?

Carsten Bormann <cabo@tzi.org> Sun, 25 August 2019 21:32 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 5CE65120044 for <cbor@ietfa.amsl.com>; Sun, 25 Aug 2019 14:32:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -4.198
X-Spam-Level:
X-Spam-Status: No, score=-4.198 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_NONE=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 x6xz4HOfyoXs for <cbor@ietfa.amsl.com>; Sun, 25 Aug 2019 14:32:43 -0700 (PDT)
Received: from gabriel-vm-2.zfn.uni-bremen.de (gabriel-vm-2.zfn.uni-bremen.de [134.102.50.17]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id CF7AB120020 for <cbor@ietf.org>; Sun, 25 Aug 2019 14:32:42 -0700 (PDT)
Received: from [192.168.217.120] (p548DCCB9.dip0.t-ipconnect.de [84.141.204.185]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gabriel-vm-2.zfn.uni-bremen.de (Postfix) with ESMTPSA id 46GpJS6LQVz10FH; Sun, 25 Aug 2019 23:32:40 +0200 (CEST)
Content-Type: text/plain; charset="utf-8"
Mime-Version: 1.0 (Mac OS X Mail 11.5 \(3445.9.1\))
From: Carsten Bormann <cabo@tzi.org>
In-Reply-To: <09A5B3BF-28F1-4543-89E6-DCD8CCA0477B@island-resort.com>
Date: Sun, 25 Aug 2019 23:32:40 +0200
Cc: cbor@ietf.org
X-Mao-Original-Outgoing-Id: 588461558.42977-6ef48e321a65ad5eab2774a5c3d32e1f
Content-Transfer-Encoding: quoted-printable
Message-Id: <A4D19CD5-4F3E-4E81-9792-15D43BFA4096@tzi.org>
References: <D4C38A34-F601-4173-A686-362DDE4E8BEE@island-resort.com> <0515B626-7968-43C1-950E-5AD5FCEA2671@tzi.org> <39C91AF6-7948-46E4-8FDA-F1F8188A107D@island-resort.com> <C893901A-EE56-45E9-9CF2-CB800AD38DA1@tzi.org> <09A5B3BF-28F1-4543-89E6-DCD8CCA0477B@island-resort.com>
To: Laurence Lundblade <lgl@island-resort.com>
X-Mailer: Apple Mail (2.3445.9.1)
Archived-At: <https://mailarchive.ietf.org/arch/msg/cbor/y2oPk-2XOb3G5UdJIIpAM2OwKeE>
Subject: Re: [Cbor] Invalid decimal fraction / big float?
X-BeenThere: cbor@ietf.org
X-Mailman-Version: 2.1.29
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, 25 Aug 2019 21:32:45 -0000

> CWT aside, by my understanding, it is allowed for CBOR protocols to make use of the data types defined in “Optional Tagging of Items” section of 7049 without explicitly adding a tag. 

Absolutely.  Making that easier to do was one reason we introduced ~ (unwrap) in CDDL.


> 
> For example, I could say in the EAT definition that the claim labeled “teetime”  is a tag 1 epoch-based date as defined in 7049. EAT could (should?) then say which of a), b) or c) is allowed for use of the tag 1. Right?

Well, EAT should simply say what the claim is.  There is no need for a/b/c here.
Either you use the tag or just its definition of the semantics applied to the enclosed data item; I can’t imagine a case where anything is gained by allowing both.

> When CWT says “MUST NOT be prefixed with any CBOR tag”, it sounds semantically like “forbidden” to me.

Yes.  But it’s not that CWT forbids tags, it is that it defines the first seven claims for CWT in a way that does not make use of tags.  It would be as misleading to say that “COSE is forbidden in CWT” because the first seven claims don’t use COSE.

>>> c) optional — (I don’t know of an example)
>> 
>> Any protocol that uses CDDL `unsigned` has “optional” Tags:
>> Numbers below 2**64 do not use Tags, numbers equal to or greater than 2**64 do.
>> 
>>> A good generic decoders will handle all three, probably with some feature in the API to say which of the above scenarios to use.
>> 
>> Since the generic decoder hands the application the decoded data item, the application can handle the Tags and their being required/optional/forbidden.
> 
> Generic decoders can handle tagged types inside the decoder itself.

They never can for all tags, because all tags haven’t been invented yet.

> Mine does. That means those types of generic decoders have to know about case a), b) and c).

I still don’t think so.  That would only be the case if the decoder doesn’t “handle” the tag, but “hides” it.  That would indeed lead to problems.

> Despite my nit picking, I really do like CBOR a lot

Thanks.  We need to have these discussions to ensure we don’t have language in the spec that turns out to be misleading.  I just pushed a pull request for CBORbis that massively rearranges the language around tags, please have a look:

https://github.com/cbor-wg/CBORbis/pull/109

Grüße, Carsten