devicetree-spec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <rob.herring-5wv7dgnIgG8@public.gmane.org>
To: Kumar Gala <kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	"Bolivar,
	Marti" <Marti.Bolivar-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org>,
	Grant Likely <Grant.Likely-5wv7dgnIgG8@public.gmane.org>,
	David Gibson
	<david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
Cc: devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Node name & property name collusion - json/yaml implications
Date: Fri, 5 Feb 2021 11:25:36 -0600	[thread overview]
Message-ID: <65e8549e-2c90-903a-ed70-a1bda1a02af7@arm.com> (raw)
In-Reply-To: <C008DF92-364E-4892-A1C0-68A2C97BE946-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

On 2/5/21 6:57 AM, Kumar Gala wrote:
> There’s an old thread about this from 2016:
>
> https://www.spinics.net/lists/devicetree-spec/msg00296.html
>
> In which its clearly stated that node names and property names technically can be the same.  However, as we’ve starting utilizing tooling like JSON for validation, does it make sense to maintain this and should we update the specification to require that a node name and property name at the same hierarchy in the tree is not allowed?
>

IMO, yes. We are effectively doing that already given some of the
tooling doesn't really support it.

We've removed the few, rare cases in the kernel tree dts files.

> Otherwise we get into fun situations like, being valid DTS, but invalid YAML, and various tools not working correct as the YAML loaders have to pick one or there the other version of ‘foo’:
>
> [Example is from Marti]
>
> /dts-v1/;
> / {
>       foo;
>       foo {
>               bar = <0>;
>       };
> };
>
> (Using pyYAML)
>
> $ dtc -I dts -O yaml ./foo.dts | python -c 'import sys, yaml; print(yaml.safe_load(sys.stdin.read()))’
> [{'foo': {'bar': [[0]]}}]
>
> (Using ruamel, w/allow_duplicate_keys as dt-schema does)

That reminds me, I need to go turn that off.

>
> $ dtc -I dts -O yaml ./foo.dts | python -c 'import sys, ruamel.yaml; yaml = ruamel.yaml.YAML(typ="safe"); yaml.allow_duplicate_keys = True; print(yaml.load(sys.stdin.read()))’
> [{'foo': True}>
> - k
>
IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

  parent reply	other threads:[~2021-02-05 17:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-05 12:57 Node name & property name collusion - json/yaml implications Kumar Gala
     [not found] ` <C008DF92-364E-4892-A1C0-68A2C97BE946-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-05 17:25   ` Rob Herring [this message]
     [not found]     ` <65e8549e-2c90-903a-ed70-a1bda1a02af7-5wv7dgnIgG8@public.gmane.org>
2021-02-05 17:28       ` Kumar Gala
2021-02-06  7:11   ` David Gibson
     [not found]     ` <20210206071131.GA61463-l+x2Y8Cxqc4e6aEkudXLsA@public.gmane.org>
2021-02-08 14:39       ` Kumar Gala
     [not found]         ` <9B77D509-0790-4210-9B24-24527A8743D8-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2021-02-10  1:35           ` David Gibson
2021-02-08 15:01       ` Rob Herring
     [not found]         ` <CAL_Jsq+e7JjDJTAkDJj_6bcc70QZSZ3cP8012TE7QEf3+sid3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 15:47           ` Arnd Bergmann
     [not found]             ` <CAK8P3a34jOEFo6YfW752bVjEkh4sVr1dnRU+Y0wW9r+9YHXrzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 16:00               ` Rob Herring
     [not found]                 ` <CAL_JsqKxuN-3_2eMbmxnLGXCo2PjOVxqsn7RQqQwTdKg_sJLAg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-02-08 16:07                   ` Kumar Gala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=65e8549e-2c90-903a-ed70-a1bda1a02af7@arm.com \
    --to=rob.herring-5wv7dgnigg8@public.gmane.org \
    --cc=Grant.Likely-5wv7dgnIgG8@public.gmane.org \
    --cc=Marti.Bolivar-hR+23Fw+YnFSHonuZl5R5Q@public.gmane.org \
    --cc=david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org \
    --cc=devicetree-spec-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kumar.gala-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).