xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <xadimgnik@gmail.com>
To: "'Ian Jackson'" <ian.jackson@citrix.com>,
	"'Nick Rosbrook'" <rosbrookn@gmail.com>
Cc: 'Nick Rosbrook' <rosbrookn@ainfosec.com>,
	xen-devel@lists.xenproject.org,
	'George Dunlap' <George.Dunlap@citrix.com>,
	'Wei Liu' <wl@xen.org>,
	'Andrew Cooper' <Andrew.Cooper3@citrix.com>
Subject: RE: [PATCH for-4.14] golang/xenlight: sort cases in switch statement
Date: Mon, 15 Jun 2020 17:00:51 +0100	[thread overview]
Message-ID: <002f01d6432e$2545b410$6fd11c30$@xen.org> (raw)
In-Reply-To: <24295.38675.682397.522303@mariner.uk.xensource.com>

> -----Original Message-----
> From: Ian Jackson <ian.jackson@citrix.com>
> Sent: 15 June 2020 16:43
> To: Nick Rosbrook <rosbrookn@gmail.com>
> Cc: xen-devel@lists.xenproject.org; paul@xen.org; Andrew Cooper <Andrew.Cooper3@citrix.com>; Nick
> Rosbrook <rosbrookn@ainfosec.com>; George Dunlap <George.Dunlap@citrix.com>; Wei Liu <wl@xen.org>
> Subject: Re: [PATCH for-4.14] golang/xenlight: sort cases in switch statement
> 
> Nick Rosbrook writes ("[PATCH for-4.14] golang/xenlight: sort cases in switch statement"):
> > The xenlight_golang_union_from_C function iterates over a dict to
> > construct a switch statement that marshals a C keyed union into a Go
> > type. Because python does not guarantee dict ordering across all
> > versions, this can result in the switch statement being generated in a
> > different order depending on the version of python used. For example,
> > running gengotypes.py with python2.7 and python3.6 will yield different
> > orderings.
> >
> > Iterate over sorted(cases.items()) rather than cases.items() to fix
> > this.
> >
> > This patch changes the ordering from what was previously checked-in, but
> > running gengotypes.py with different versions of python will now yield
> > the same result.
> >
> > Signed-off-by: Nick Rosbrook <rosbrookn@ainfosec.com>
> > ---
> > Andrew reported this in [1], so I intend this as a build fix for 4.14.
> >
> > [1] https://lists.xenproject.org/archives/html/xen-devel/2020-06/msg00881.html
> > ---
> >  tools/golang/xenlight/gengotypes.py  |  2 +-
> >  tools/golang/xenlight/helpers.gen.go | 32 ++++++++++++++--------------
> >  2 files changed, 17 insertions(+), 17 deletions(-)
> >
> > diff --git a/tools/golang/xenlight/gengotypes.py b/tools/golang/xenlight/gengotypes.py
> > index ecca59745f..557fecd07b 100644
> > --- a/tools/golang/xenlight/gengotypes.py
> > +++ b/tools/golang/xenlight/gengotypes.py
> > @@ -379,7 +379,7 @@ def xenlight_golang_union_from_C(ty = None, union_name = '', struct_name = ''):
> >
> >      # Create switch statement to determine which 'union element'
> >      # to populate in the Go struct.
> > -    for case_name, case_tuple in cases.items():
> > +    for case_name, case_tuple in sorted(cases.items()):
> >          (case_val, case_type) = case_tuple
> 
> This part
> 
> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
> 
> But I don't think I have the right golang tools to verify the
> autogenerated code.  George, can you check that this patch is right,
> and/or do the commit and rerun the generation ?
> 
> Obviously that needs to wait for a release ack.
> 

Assuming George is happy...

Release-acked-by: Paul Durrant <paul@xen.org>

> Ian.



  reply	other threads:[~2020-06-15 16:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 15:39 [PATCH for-4.14] golang/xenlight: sort cases in switch statement Nick Rosbrook
2020-06-15 15:43 ` Ian Jackson
2020-06-15 16:00   ` Paul Durrant [this message]
2020-06-15 16:02   ` George Dunlap

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='002f01d6432e$2545b410$6fd11c30$@xen.org' \
    --to=xadimgnik@gmail.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=ian.jackson@citrix.com \
    --cc=paul@xen.org \
    --cc=rosbrookn@ainfosec.com \
    --cc=rosbrookn@gmail.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 NNTP newsgroup(s).